W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] canvas, img, file api and blobs

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 15 Feb 2010 13:53:10 -0800
Message-ID: <63df84f1002151353y29790009jc2d62e3a2997239@mail.gmail.com>
On Mon, Feb 15, 2010 at 6:43 AM, Stef Epardaud <stef at epardaud.fr> wrote:
> Hello,
>
> I am trying to write a client-side application in HTML5 that resizes
> images before uploading them to the server. I saw several demos that did
> this resizing using canvas and img, but I have only seen how to get a
> data URL out of a canvas, and since Base64 is about 1.37% larger than
> the equivalent binary data (according to http://en.wikipedia.org/wiki/Base64),
> I wonder why it is not possible to get a Blob out of the canvas?
> Especially since the File API supports uploading Blobs.

It has been suggested earlier on this list that we add a

canvas.toFile
or
canvas.toBlob

function, which would return a binary Blob instead of a data URL. For
exactly the reasons that you mention. I hope to write a test
implementation of this for firefox in the near future.

> In a related question, is there any guarantee that when we draw an image
> with EXIF information into a canvas for resizing, we get (or not) the
> EXIF back in the resized image (currently via toDataURL())?

Like Boris says, no, copying an image into a canvas doesn't copy the
EXIF data. It would make sense to add some API to canvas that allows
importing metadata from a given image.

/ Jonas
Received on Monday, 15 February 2010 13:53:10 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC