[whatwg] Supporting scanners on the web

Jonas Sicking jonas at sicking.cc
Thu Sep 26 22:29:32 PDT 2013

On Thu, Sep 26, 2013 at 8:19 AM, Benjamin Smedberg
<benjamin at smedbergs.us> wrote:
> One of the use cases that has come up for why people are still using plugins
> is supporting scanning to the web, in particular multi-page scanning. It
> seems to me that we could hook this up to <input type="file" multiple>, but
> that we should try to provide UAs with a hint that a page expects a document
> instead of images.

What we've done in Firefox for Android is to treat <input type=file
accept="image/*"> as a hint that the page wants an image any source.
So we give the user options to use any built-in gallery or camera apps
for example.

We could do the same on desktop platforms and display an additional
button next to the normal "select file" button if we detected that
there are additional image sources like cameras or scanners available.

There's also been proposals around <input type=file accept="image/*"
capture>. This was supposed to mean "invoke media specific capturing
methods". I think there was also something like <input type=file
capture=camera> being proposed which would specifically enable
camera-backed capturing.

> * Should we give the site any way to specify preferred resolution or color
> depth for an image? Or should the site be prepared process any images to the
> required resolution, convert to monochrome, etc.

The most requested ability is to resize images to a particular
resolution. This is something that can be done using canvas, but not
for videos or animated images. And currently you can't do it off the
main thread, which is an issue for larger images.

It would be nice to expose a image-resize API to the web. This way
they could do things like resize images to the various sizes needed
and just upload the resized images. Currently you have to upload the
fullsized image, or you have to resize once to the maximum size you
want and upload that, and then resize again on the server. But that
results in lower image quality.

Likewise it would be nice to have an API for re-encoding images
without using canvas. This will likely be especially important if we
decide on a jpeg successor to add support for.

> * Should the spec recommend any specific MIME types for scanner page images?
> Most desktop scanners appear to default to .tiff, but that's not a normal
> web format: perhaps we should recommend that UAs convert to PNG.

Yes, definitely.

/ Jonas

More information about the whatwg mailing list