[Pdx-pm] Scan OSX Window pixel by pixel

Eric Wilhelm enobacon at gmail.com
Tue Mar 29 23:21:35 PDT 2011


# from Joshua Keroes
# on Tuesday 29 March 2011 23:00:

>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.

I think there is something being pre-computed in the Imager::Search 
constructor.  Try it with just Imager::Screenshot.

 $ time perl -MImager::Screenshot=screenshot -e 'my $s = screenshot();'
 real    0m1.131s

Then I think you just want my $color = $s->getpixel(x => 10, y => 20).  
There is also a syntax for getting multiple pixels at once.

--Eric
-- 
"If you dig it, it's yours."
--An old village poet (via Al Pacino)
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list