http://www.perlmonks.org?node_id=907340


in reply to Can i Compare two images in perl ?

Some untested code, and I don't know if Image::Compare uses ImageMagick internally? :-)
#!/usr/bin/perl use warnings; use strict; use Image::Compare; my $file1 = shift; #some jpegs, or png my $file2 = shift; my ( $cmp ) = Image::Compare->new(); $cmp->set_image1( img => $file1, type => 'png', ); $cmp->set_image2( img => $file2, type => 'png' ); $cmp->set_method( method => &Image::Compare::THRESHOLD, args => 25, ); #$cmp->set_method( # method => &Image::Compare::EXACT, # ); if ( $cmp->compare() ) { # The images are the same, within the threshold print "same\n"; } else { # The images differ beyond the threshold print "not same\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Can i Compare two images in perl ?
by Tux (Canon) on May 30, 2011 at 17:08 UTC

    Makefile.PL has requires 'Imager' => 0.54;, so the answer is no :)


    Enjoy, Have FUN! H.Merijn