Skip to content

Instantly share code, notes, and snippets.

@bigalex95
Last active January 23, 2023 04:32
Show Gist options
  • Save bigalex95/db0f99f424d07bc72808ea336eda7287 to your computer and use it in GitHub Desktop.
Save bigalex95/db0f99f424d07bc72808ea336eda7287 to your computer and use it in GitHub Desktop.
width = 256;
height = 256;
let dst = new Uint8Array(Module.HEAPU8.buffer, dst_ptr, width * height);
canvasResultsLenna.width = width;
canvasResultsLenna.height = height;
var imgData = ctxResultsLenna.createImageData(width, height);
for (var i = 0; i < dst.length; i++) {
imgData.data[i * 4] = dst[i];
imgData.data[i * 4 + 1] = dst[i];
imgData.data[i * 4 + 2] = dst[i];
imgData.data[i * 4 + 3] = 255;
}
console.log(imgData);
ctxResultsLenna.putImageData(imgData, 0, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment