Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy data property</title> </head> <body> <h2>Wikitechy ImageData data Property</h2> <canvas id="WikitechyCanvas" width="300" height="200" style="border:1px solid blue;"> </canvas> <script> var c = document.getElementById("WikitechyCanvas"); var context = c.getContext("2d"); var imgData = context.createImageData(150, 150); var img; for (img = 0; img < imgData.data.length; img += 4) { imgData.data[img+0] = 255; imgData.data[img+1] = 0; imgData.data[img+2] = 100; imgData.data[img+3] = 200; } context.putImageData(imgData, 20, 20); </script> </body> </html>
Result