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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -