compare returns always 0

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
em4work
Posts: 1
Joined: 2011-08-29T22:04:06-07:00
Authentication code: 8675308

compare returns always 0

Post by em4work »

i run the following script on 2 machines:
1. centos5 ImageMagick 6.7.1-6
2. centos6 ImageMagick 6.7.1-9

both has the same script and run on same jpgs. the jpgs are identical except for a different date text written on both
on the centos5 i get "Error is 25.458516, Mean Error is 0.000388"
on centos6 the error always 0.000

the script:
use Image::Magick;
$g1 = Image::Magick->new;
$g2 = Image::Magick->new;
$w = $g1->Read( filename=>"11.jpg");
$w = $g2->Read( filename=>"12.jpg");
$w = $g1->Compare(image=>$g2); # compare
printf ("Errors is %f\n", $g1->Get('error'));
printf ("Mean Error is %f\n", $g1->Get('mean-error'));

off course the problem is on the centos6, cause the jpgs has difference
any ideas?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compare returns always 0

Post by magick »

Here is the correct code:

Code: Select all

$g3 = $g1->Compare( image=>$g2, metric=>'RMSE' ); # compare
if (ref($g3)) {
    printf ("Errors is %f\n", $g3->Get( 'error' ));
}
Post Reply