9 ms·
It is possible, as you can now get the raw pixel data of an image by copying it to a canvas and using getImageData. <img src="test.gif" id="img"> <scr
by streptomycin 14y ago
It is possible, as you can now get the raw pixel data of an image by copying it to a canvas and using getImageData.
<img src="test.gif" id="img">
<script type=text/javascript>
var img = document.getElementById("img");
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
</script>
Then you can do whatever you want with the pixel data.