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

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2017-05-26 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?