Creating a DOOM-inspired aesthetic with PlayCanvas
omarshehata.me
omarshehata.me
WebGL on the other hand, has the option to tell the browser not to apply colorspace info or whatever other tweaks the browser would usually to do the data so if you want to read a PNG raw you can load it as a texture, attach it to a framebuffer, and call readPixels and get the raw data. You don't need to decode PNGs in JS although that's certainly a viable solution.
(huge fan of your work by the way!)
Of course that has pluses and minus. The plus is browsers can try to be more efficient. The minus is the issue you ran into which is frustrating.
Maybe someone (me?) should go update the MDN docs with a note :P
Also, for those unfamiliar with PlayCanvas: it's an open source javascript game engine that is kinda like halfway between something like three.js and e.g. Unity—pretty lightweight, but still comes with a nice scene editor etc.