GD - Sampling pixel color on screen

Posted on Thu Jan 10 16:13:03 2008 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
Write a response