get pixel of image javascript code example
Example 1: js get color of pixel
var pixelData = canvas.getContext('2d').getImageData(event.offsetX, event.offsetY, 1, 1).data;
Example 2: getImageData()
ctx.getImageData(sx, sy, sw, sh);
var pixelData = canvas.getContext('2d').getImageData(event.offsetX, event.offsetY, 1, 1).data;
ctx.getImageData(sx, sy, sw, sh);