Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Can i Compare two images in perl ?

by zentara (Archbishop)
on May 30, 2011 at 17:04 UTC ( [id://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 (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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://907340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-25 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found