- From: David Flanagan <dflanagan@mozilla.com>
- Date: Fri, 07 Jun 2013 13:42:24 -0700
- To: whatwg <whatwg@lists.whatwg.org>
- Cc: Jonas Sicking <sicking@mozilla.com>
If the second argument to Canvas.toBlob() and Canvas.toBlobHD() is "image/jpeg", then these methods support a third argument to specify JPEG compression level. The spec (http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#a-serialization-of-the-bitmap-as-a-file) says: > A future version of this specification will probably define other > parameters to be passed to these methods to allow authors to more > carefully control compression settings, image metadata, etc. I would like to propose the addition of a fourth argument (for the JPEG case only) that would specify EXIF metadata to be included in the JPEG blob. (I have not tried yet, but I'm assuming that we could define some suitable JSON serialization format for EXIF data. If not, then even allowing a binary blob of EXIF data as the fourth argument would be helpful.) The use case for this feature is image editing applications, like the Gallery app on FirefoxOS devices. Whenever that app crops or edits a photo it encodes the edited photo with Canvas.toBlob(), and the process strips all metadata from the photo. Reading EXIF data from a JPEG blob is relatively straightforward can can be done with JavaScript, but inserting EXIF data into an existing blob is much harder: this is a task that is best done when the JPEG blob is being created, which means that it is a feature that belongs in toBlob and can not be done efficiently with an external library. [A related, but perhaps too ambitious, proposal is to allow direct read/write access to EXIF metadata via HTMLImageElement. The primary use case for read access is to enable web apps to trivially determine when, where, and how a photo was taken and also to determine authorship and copyright information for an image. The primary use case for write access might be for selectively stripping metadata. It would be nice to be able to protect user privacy with code as simple as |delete image.metadata.geolocation| for example.] David Flanagan
Received on Friday, 7 June 2013 20:42:51 UTC