I need to mouseover a picture and return what color the pixel is that the mouse is pointing to, how can i do this?
| SitePoint Sponsor |





I need to mouseover a picture and return what color the pixel is that the mouse is pointing to, how can i do this?



I don't think that there is a built in function, although, using a workaround you can probably do it.
look here for info on finding the mouse position on the page: (in both ie and netscape)
http://www.dansteinman.com/dynduo/en/mouseevents.html
then, you would need to create an array of every pixel of the image with the proper color...(you might be able to find a program that does this for you)
Hope that helps
Compwizard
"There are 10 kinds of people in this world -- those who know binary, and those who don't."
If you really do need to do this, you might be better off using Java - you could pass the image to be displayed as a parameter, and return the colour of the pixel that the mouse pointer that the image is hovering above as an RGB or Hex value. You might even be able to this in Flash...!
Perhaps you could explain exactly what you are trying to do - there may be a completely different way of achieving your aim.
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code
- Please think, Google, and search these forums before posting!
Bookmarks