Skip to content

Instantly share code, notes, and snippets.

@djabif
Created March 18, 2014 01:29
Show Gist options
  • Save djabif/9611904 to your computer and use it in GitHub Desktop.
Save djabif/9611904 to your computer and use it in GitHub Desktop.
// render result back to canvas
var data_u32 = new Uint32Array(imageData.data.buffer);
var alpha = (0xff << 24);
var i = img_u8.cols*img_u8.rows, pix = 0;
while(--i >= 0) {
pix = img_u8.data[i];
data_u32[i] = alpha | (pix << 16) | (pix << 8) | pix;
}
ctx.putImageData(imageData, 0, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment