|
Posted by perry zhou on September 3, 2004, 11:05 pm
Please log in for more thread options
I tried to use Compare function in Image::Magick module to compare 2
images, but I cannot get it work. I don't know what's the required
image handle. I searched in google, and was unable to find any
examples. Anyone can give some help?
Thanks in advance!
|
|
Posted by Tim Heaney on September 4, 2004, 11:16 am
Please log in for more thread options
pengxiang_zhou@yahoo.com (perry zhou) writes:
> I tried to use Compare function in Image::Magick module to compare 2
> images, but I cannot get it work. I don't know what's the required
> image handle. I searched in google, and was unable to find any
> examples. Anyone can give some help?
Since you're comparing two images, you need two image objects. You're
invoking the Compare method on one. The image handle it's looking for
is simply the other image object. So you might have something like
$image1 = Image::Magick->new;
$status = $image1->Read($file1);
warn "$statusn" if $status;
$image2 = Image::Magick->new;
$status = $image2->Read($file2);
warn "$statusn" if $status;
$status = $image1->Compare(image => $image2);
warn "$statusn" if $status;
print "mean error per pixel: ", $image1->Get('error'), "n";
I hope this helps,
Tim
|
|
Posted by perry zhou on September 7, 2004, 2:37 pm
Please log in for more thread options > pengxiang_zhou@yahoo.com (perry zhou) writes:
>
> > I tried to use Compare function in Image::Magick module to compare 2
> > images, but I cannot get it work. I don't know what's the required
> > image handle. I searched in google, and was unable to find any
> > examples. Anyone can give some help?
>
> Since you're comparing two images, you need two image objects. You're
> invoking the Compare method on one. The image handle it's looking for
> is simply the other image object. So you might have something like
>
> $image1 = Image::Magick->new;
> $status = $image1->Read($file1);
> warn "$statusn" if $status;
>
> $image2 = Image::Magick->new;
> $status = $image2->Read($file2);
> warn "$statusn" if $status;
>
> $status = $image1->Compare(image => $image2);
> warn "$statusn" if $status;
>
> print "mean error per pixel: ", $image1->Get('error'), "n";
>
> I hope this helps,
>
> Tim
Tim,
Your example code solves my problem. Really appreciate your help!
Thank you again!
|
| Similar Threads | Posted | | ImageMagick and threads | October 12, 2004, 1:44 pm |
| Any ImageMagick Gurus out there? I need HELP! | November 7, 2006, 2:33 pm |
| Newb Needs Help with Simple ImageMagick Module | October 26, 2005, 11:02 am |
| ImageMagick and Xitami jpeg/bmp issue | June 28, 2006, 9:40 am |
| CAM::PDF and images | February 23, 2006, 9:56 am |
| How to join two images with 'GD::Image' | June 25, 2007, 4:36 am |
| Loading (from Internet), resizing and saving images | March 22, 2005, 6:15 am |
| Converting images with padding or cropping on left and right | September 23, 2007, 8:55 am |
| ANNOUNCE: List-Compare-0.31 | August 15, 2004, 10:26 am |
| ANNOUNCE: List::Compare v0.31 | August 22, 2004, 2:06 pm |
|