[whatwg] Image resize API proposal

David Levin levin at google.com
Thu May 27 10:13:39 PDT 2010

On Tue, May 25, 2010 at 3:58 AM, Kornel Lesinski <kornel at geekhood.net>wrote:

> JPEG can be efficiently decoded at fraction of its size — without full
> decode and scale process. This process also needs only fraction of memory
> required for full scaling, which might matter on low-end mobile devices.
> Letting UA utilize this feature may give huge performance gains.

Agreed. I could see this being done.

> Scaling isn't the only operation desirable — in some cases users might also
> want to crop the image (e.g., to upload only their face as an avatar), and
> cropping interface needs to be platform-specific — on touchscreen devices
> I'd rather use gestures than select-by-click'n'drag interface typical for
> desktop.


> I think scaling of images before upload might be left completely up to UA.
> From site's perspective it could look like user simply selected scaled-down
> file. It could even be done declaratively — site could define desired size
> and whether user should be asked to crop the image:
> <input type="file" accept="image/*" max-image-size="1000x1000"
> crop="allowed">

This appears to be so limited that it doesn't allow for the web page to
display a preview of what is being uploaded. Take the gmail example from
that I gave in this thread, where the image is dragged into an email and
then the image is resized before uploading. Ideally, the image shown in the
email would be the image that is being sent.

> Actually, I wish UAs offered scaling even for plain <input type=file>,
> because I don't expect every site with image upload to add extra code for
> resizing.

I agree that having it be totally declarative would be simpler to write in a
web page.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100527/a77dd7f2/attachment-0001.htm>

More information about the whatwg mailing list