[whatwg] HTML Canvas Element getBlob

Charles Pritchard chuck at jumis.com
Mon Dec 27 13:32:11 PST 2010


I'd like to see Blob output added to the HTML Canvas element :

Blob getBlob(in optional DOMString type, in any... args);

Currently, an image must be copied to a string using toDataURL, then to 
an array buffer using base64 decoding, before it can be run through 
createObjectURL.
getBlob would reduce the number of operations.

I've added a webkit bug report for it:
https://bugs.webkit.org/show_bug.cgi?id=51652

getBlob is already a "used" term, in the File API, this matches it nicely,
while also matching the usage of toDataURL in the HTML Canvas Element 
interface.

As many vendors are supporting Blob (and createObjectURL), this seems to 
be a very easy addition
to the spec, as well as various code bases. It's benefits are immediate.

There was some recent talk of it here:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-December/029492.html
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-March/025518.html


Most of the discussion/objections are around other use cases. I'm presenting
a very simple case, and I don't think it needs to be held-up by the 
other use
cases mentioned (mainly, web workers).

The simple use case, is using  a blob uri, instead of a data uri, within 
the DOM,
as this means a lot less passing around of large base64 encoded png 
references.


-Charles


More information about the whatwg mailing list