Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output attributes on HTML's <input type=file> element #237

Closed
marcoscaceres opened this issue Dec 24, 2019 · 5 comments · Fixed by #361
Closed

output attributes on HTML's <input type=file> element #237

marcoscaceres opened this issue Dec 24, 2019 · 5 comments · Fixed by #361
Labels
under review w3c-cg Specifications in W3C Community Groups (e.g., WICG, Privacy CG)

Comments

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Dec 24, 2019

Request for Mozilla Position on an Emerging Web Specification

Other information

Proposal to add various output attributes on HTML's <input> elements that would allow developers to declare some conversions the browser could do to, for example, images and videos.

<input type="file" 
   accept="image/*"
   output="image/jpeg"
   outputDimensions="1:1">

Conversions can include:

  • format
  • size
  • length
  • dimensions
  • compression
  • possibly other things...

This is intended to address the long-tail problem and complexity of converting/editing files by deferring the problem to either the OS or the browser (instead of JS libraries, CDNs, WASM, etc., which, it is argued by those making the proposal, haven't seen adoption in the long tail).

@marcoscaceres marcoscaceres added the w3c-cg Specifications in W3C Community Groups (e.g., WICG, Privacy CG) label Dec 24, 2019
@bholley
Copy link
Collaborator

bholley commented Dec 25, 2019

I am sympathetic to the argument that, even if client-side image optimization is technically possible today, it's the sort of complex thing that gets deployed by big sites when optimizing at scale. So this could both empower smaller developers, and nudge the ecosystem in a positive direction.

On the flip side, I'm concerned about runaway complexity. The WICG thread is already talking about options for chroma sub-sampling, and it's not at all clear to me where the feature line should be drawn. Same goes for formats and media types.

@marcoscaceres
Copy link
Contributor Author

On the flip side, I'm concerned about runaway complexity.

Agree, I also said the same in the thread. I think it should be possible to find a reasonable sub-set however. There is some precedence on iOS around images, for instance, and file size hints... and we could definitely make a case to triage, say, 2-3 things that would give the most return on investment. If those become interoperable, then pick up the next few from there and incrementally build on those across UAs.

@dbaron
Copy link
Contributor

dbaron commented Apr 10, 2020

I'm concerned about complexity, and also concerned about inability to hook things up to other APIs the browser has reducing the value. I'd be less concerned about the latter if it output something like ImageData (although that probably has some current issues), and the platform had mechanisms for converting ImageData to various other things. It's also one of those spaces where I'd wonder why there aren't successful javascript libraries if the current state is that it's so hard.

Maybe it makes more sense to start by more directly exposing the existing primitives, e.g., through a conversion of Blob to ImageData or something like that, which could then be usable from the existing input.files but also from other things.

@dbaron
Copy link
Contributor

dbaron commented Jun 5, 2020

I think my inclination is to mark this as non-harmful, given that:

  • I would be more likely to support prototyping of a proposal that was less inclined towards runaway complexity, and more inclined towards composability with other features
  • but it does seem to be addressing real use cases and doesn't seem harmful.

Thoughts?

@annevk
Copy link
Contributor

annevk commented Jun 6, 2020

It would indeed make much more sense to me if this were defined in terms of createImageBitmap() or some such.

The other consideration here is that I think we only mandate conversion to PNG today, though I think implementations support JPEG too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under review w3c-cg Specifications in W3C Community Groups (e.g., WICG, Privacy CG)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants