[Pdx-pm] Scan OSX Window pixel by pixel

Joshua Keroes joshua at keroes.com
Tue Mar 29 23:00:55 PDT 2011

On Tue, Mar 29, 2011 at 10:37 PM, Eric Wilhelm <enobacon at gmail.com> wrote:
>>> I have a Java window displayed on my Mac. I'd like to determine the
>>> color for any arbitrary pixel in the window. Ideas on how to approach
>>> this problem?
>>Found a promising CPAN module, Imager::Search::Screenshot. The
>>SYNOPSIS snippet this takes 12 seconds to run, a little longer than
>>the fractional seconds I was aiming for. *cue sad trombone*
> Do you mean Imager::Screenshot?  Imager::Search::Screenshot has no
> SYNOPSIS that I can see.
> To get the color of any pixel should be rather quick with e.g.
> Image::Magick or GD.  Is getting a screenshot with Imager::Screenshot
> taking 12 seconds?

Yeah. Here's the screenshot of the desktop, I think:

my $image = Imager::Search::Screenshot->new(
    [ id => 0 ],
    driver => 'BMP24',

Granted, that's a large region, but for my needs, 12 seconds is way too slow.

What's fast enough? I'd like to be able to rasterize a window and scan
select pixels in about under .25 seconds.


More information about the Pdx-pm-list mailing list