SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can i detect colours of pixels on images

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

  2. #2
    SitePoint Evangelist compwizard's Avatar
    Join Date
    May 2002
    Location
    United States
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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."

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •