I have an image on a browser.
I want to get the top left pixel of the image color (at coordinates: 0,0), no matter whether the image is rotated or not.
How can I do that, using javascript or php code?
With the get() function we can read the color of any pixel in our program window. We can specify which pixel we are interested in by using x and y coordinates as parameters. For example, color mycolor = get(100, 200); would grab the color of pixel 100, 200 and put that color into the mycolor variable.
You can also obtain pixel value information from a figure with imshow by using the impixelinfo function. To save the pixel location and value information displayed, right-click a pixel in the image and choose the Copy pixel info option. Image Viewer copies the x- and y-coordinates and the pixel value to the clipboard.
canvas.getContext('2d')
context.drawImage(image, x, y)
context.getImageData(x1, y1, x2, y2)
context.getImageData(0, 0, 1, 1)
data
field (context.getImageData(0,0,1,1).data
)
r
, g
, b
and a
values.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With