in reply to compare images with perl 5.6 or 5.8

Imager does it too. Use the same i1.png and i2.png files from my example above, and this script will give the same output as ImageMagick.
#!/usr/bin/perl use warnings; use strict; use Imager; my $img = Imager->new; $img->read(file=>'i1.png', type=>'png') or die "Cannot read: ", $img->errstr; my $img1 = Imager->new; $img1->read(file=>'i2.png', type=>'png') or die "Cannot read: ", $img1->errstr; my $out = $img->difference( other => $img1 ); $out->write(file=>"$0-diff.png", type=>'png') or die "Cannot write: ",$out->errstr;

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: compare images with perl 5.6 or 5.8
by kanegr (Acolyte) on Dec 29, 2008 at 15:33 UTC
    The versions of perl I have do not contain those modules. That's the trick. I know there are tons of libraries out there that do this but the problem is that my toolset I have to work with is very limited.
Re^2: compare images with perl 5.6 or 5.8
by ravi.naga (Initiate) on Jan 15, 2010 at 07:33 UTC
    I got the below output when tried to compare 2 png images. Cannot read: format 'png' not supported - formats bmp, ico, pnm, raw, sgi, tga available for reading Could you please help me to know the reason.
      The error means that when you compiled Imager, you didn't have libpng installed on your system, so png support was skipped. Install the full libpng ( some distros separate the development headers into something like libpng-devel. Just google for libpng, compile it, install it, then rebuild Imager.

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