Re: [whatwg] Add EXIF metadata support in Canvas.toBlob?

On Fri, Jun 7, 2013 at 1:42 PM, David Flanagan <dflanagan@mozilla.com> wrote:
> 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.]

If someone goes through the work of defining an EXIF <->  JSON mapping
then this is something I'd be interested to see added to the spec.

It definitely would be nice to enable modifying EXIF metadata without
having to re-encode the pixel data since that leads to loss of
quality.

/ Jonas

Received on Friday, 7 June 2013 21:33:58 UTC