Posted on 2008-01-10 14:13:03-08 by craigc
Sampling pixel color on screen
Hi everyone,

  What is the best way to sample the color of a pixel on the screen? In other words, how close can I get to the following:

my ($r,$g,$b) = GetPixelOnScreen($ScreenX,$ScreenY)

where $ScreenX, and $ScreenY are screen coordinates instead of image file coordinates?

  If I have to take a screen shot first, save that to a file, then analyze the file, I'm willing to do that, it just seems like overkill. Is there an easier way? If there's not an easier way, what's the best way to get the screen image into a format that GD can parse?

Thanks very much.
  Craig
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.