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

[whatwg] HTML Canvas Element getBlob

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 27 Dec 2010 17:20:51 -0500
Message-ID: <AANLkTikYRdpOB7HD54sgRnFpzWYRhAgEzA-UEug9J2=C@mail.gmail.com>
On Mon, Dec 27, 2010 at 4:32 PM, Charles Pritchard <chuck at jumis.com> wrote:
> I'd like to see Blob output added to the HTML Canvas element :
> Blob getBlob(in optional DOMString type, in any... args);

This should be asynchronous, eg:

void getBlobAsync(in Function oncomplete, in Function onerror, in
optional DOMString type, in any... args);

where oncomplete is called with the resulting Blob after compression finishes.

Compressing a large canvas can take some time, especially at higher
compression levels--saving a fairly small, 1000x1000 image to PNG in
Photoshop takes almost five seconds on my system.  A UA may also queue
canvas operations if the canvas isn't visible; it sometimes seems like
Chrome is doing this, though I'm not sure.  This gives browsers the
option of pushing all of the queue flushing and compression into the

This shouldn't be required; a UA should be permitted to run the
compression synchronously.  There should also be a way to abort
compression, since any asynchronous operation should be cancellable.
(An event-based interface like FileReader's is probably more

Glenn Maynard
Received on Monday, 27 December 2010 14:20:51 UTC

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