Re: Reading image bytes to a PNG in a typed array

On Mon, Jan 14, 2013 at 6:20 AM, Florian Bösch <pyalot@gmail.com> wrote:
>
> 1) Create canvas, set to desired size
> 2) Create 2D context
> 3) Create imageData object
> 4) Create a WebGL framebuffer object
> 5) Attach texture as color target to framebuffer
> 6) read back pixels into canvas2d's imageData.data member
> 7) ctx.putImageData into the canvas
>

You want to be rendering to a WebGL canvas, not a 2D canvas.  There's the
limitation of not being able to draw to anything except the displayed
canvas, but I think that's being worked on within WebGL.

8) call canvases toDataURL('image/png')
> 9) snip off the mime/encoding header
> 10) implement base64 decode in JS and decode to Uint8Array
>

You want toBlob, not toDataURL.

-- 
Glenn Maynard

Received on Monday, 14 January 2013 15:00:45 UTC