I have done something very similar under windows, but used ImageMagick instead of GIMP. ImageMagick has code built in for the comparison part. Here are some code snippets to give you some ideas:
# http://www.imagemagick.com/ use Image::Magick; use Win32::Screenshot; # to capture screenshots directly into image +magick bjects: sub Capture_Screen { @$image = (); $image = CaptureScreen( ); die "FAILED: Capture-Screen\n" unless ( defined $image ); # my ($w, $h) = $image->Get('columns','rows'); print "Captured: $ +w,$h\n"; $image->Set(matte=>'False'); # $image->Write('captured_scr.bmp'); } sub Capture_Area { $image2 = CaptureRect( 10,730,190,11 ); die "FAILED: Capture-Screen\n" unless ( defined $image2 ); } sub Get_Predefined_Images { # reading predefined images from disk into a hash: for my $nm ( qw( )) { $dsk_img{$nm} = Image::Magick->new(magick=>'bmp'); my $bmp_nm = "IMG_" . $nm . '.bmp'; $x = $dsk_img{$nm}->Read($bmp_nm); warn "$x" if "$x"; } } sub Compare_Area { my $wca_img = CaptureRect( $x,$y,35,13 ); die "FAILED: capture-rectangle\n" unless ( defined $wca_img ); # $cmp_img is image to compare against. $xx = $wca_img->Compare( image => $cmp_img ); warn "Status_Img: $xx" if "$xx"; my $result = $wca_img->Get('mean-error'); # $result is 0 or near zero when images match. return(1) if $result == 0; }

In reply to Re: Using Perl and the GIMP to compare images by Anonymous Monk
in thread Using Perl and the GIMP to compare images by sailortailorson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.