[whatwg] Proposal: ImageData constructor or factory method with preexisting data

Ian Hickson ian at hixie.ch
Fri Aug 9 13:32:37 PDT 2013

On Mon, 11 Mar 2013, Kenneth Russell wrote:
> It would be useful to be able to create an ImageData [1] object with 
> preexisting data. The main use case is to display arbitrary data in the 
> 2D canvas context with no data copies.

Doesn't ImageBitmap support this already? I'm not sure I understand the 
use case here. Where are you getting the image data from, that it's 
already in raw RGBA form rather than compressed e.g. as a PNG? (Presumably 
this isn't coming over the network, since I would imagine the time to 
compress and decompress an image is far smaller than the time to send 
uncompressed data. But maybe I'm wrong about that.)

On Mon, 11 Mar 2013, Justin Novosad wrote:
> The use cases I see for this new interface is for relaying image data, 
> that is *not* generated in JS.  For example, suppose a chunk of image 
> data is generated on the server side and sent to the client via 
> WebSocket.

Wouldn't you send that as a PNG and then just use ImageBitmap?

[snip the rest of this thread, which seemed to mainly discuss 
implementation details -- without knowing what the use case is, it's 
impossible to evaluate that level of detail]

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

More information about the whatwg mailing list