How to use JavaScript or jQuery to read a pixel of an image when user clicks it? -
How can I use JavaScript or jQuery to read the pixel color of the images when a user clicks on it ? (Surely (x, y) value of this pixel by subscribing to click event we have)
If you can drag the image into a canvas element then you have to return an array with RGBA value Can use the method for
var img = new image (); Img.src = 'image.jpg'; Var reference = document.getElementById ('canvas'). GetContext ('2d'); Context.drawImage (IMG, 0, 0); Data = Reference.GetMajadata (X, Y, 1, 1) .data;
Comments
Post a Comment