Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Can i Compare two images in perl ?

by zentara (Archbishop)
on May 30, 2011 at 17:04 UTC ( #907340=note: print w/replies, xml ) Need Help??

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 (Abbot) 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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://907340]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-01-17 02:33 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (195 votes). Check out past polls.