[html5] HTML5 canvas.toDataURL suggestions

Ian Hickson ian at hixie.ch
Tue Sep 17 10:45:48 PDT 2013

On Wed, 21 Aug 2013, Sigurd Lerstad wrote:
> The use case for my canvas.toDataURL improvements is making a 
> paint/drawing program and presenting more options to the user when 
> exporting to a file format.

If we're requiring the browser to implement all these different encoding 
mechanisms for the Web, why not just go the extra step and require that 
browsers support transcoding images in the UI? Then you don't need to 
provide any of this in the drawing apps, you just provide a link to the 
image as a data: URL or some such, and the browser provides a save dialog 
that lets you configure the settings, format, etc. It would be barely any 
additional work, and would mean you wouldn't have to update both the 
browsers and the drawing apps to add new features.

On the other hand, if browsers aren't going to want to implement that 
(which seems likely), then why would they implement (at the API level) all 
the various configuration options you would want to offer? It seems almost 
certain that a drawing app would end up wanting to offer something that 
the browser doesn't support (indeed it's already happened, hence your 
e-mail). Given that, it seems that the better solution, rather than 
relying on the browser to provide an encoder, is to provide your own, 
either in JavaScript or with server support.

> As for your point of sending to a server, what if a server isn't 
> available, what if this is an offline app?

Then I guess you'd have to do it in JavaScript.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the Help mailing list