If I have an array of pixel data in JavaScript, is there a good way to display it on an HTML page?
- In recent versions of Safari and Firefox, I can create a
<canvas> and use putImageData to display pixels, but ideally the solution can work on earlier versions, and more importantly, work in Internet Explorer. - Another solution that seems more tangible could be to encode the pixels into a standard image format and create a URI
data: with pixels and set it as the src of the <img> element. Unfortunately, it seems that most image formats are complex, and it's hard for me to find a simple one that can do the job (BMP looks like an option, but doesn't work on Safari). In addition, versions of Internet Explorer prior to IE 8 do not support data: URIs at all.
I doubt anyone exists, but does anyone know image libraries for JavaScript that can generate an image in a standard format? Is there a way to replicate the functionality of a data: URI in IE 7?
source share