Problem with the `compare' utility

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pnorcks

Problem with the `compare' utility

Post by pnorcks »

Hi,
I am trying, unsuccessfully, to use the `compare' utility that comes with ImageMagick. I'm using ImageMagick 6.5.7-10 on Arch Linux (64-bit). Here are the two images I am trying to compare:

Image
Image

The command I am using:

Code: Select all

$ compare crop-new.png crop-old.png diff.png
An output file is not created, but instead I see this message:

Code: Select all

compare: images too dissimilar `crop-new.png' @ compare.c/CompareImageCommand/928.
Is this the correct behavior, or should I be using a certain command-line option to generate diff.png?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with the `compare' utility

Post by fmw42 »

this should allow it to work:

compare -dissimilarity-threshold 1 crop-new.png crop-old.png diff.png

see http://www.imagemagick.org/script/comma ... -threshold
pnorcks

Re: Problem with the `compare' utility

Post by pnorcks »

fmw42 wrote:this should allow it to work:

compare -dissimilarity-threshold 1 crop-new.png crop-old.png diff.png

see http://www.imagemagick.org/script/comma ... -threshold
Thanks, that worked perfectly.

Is this command-line option safe to use for old versions of ImageMagick (say, 6.3.7), or was it only added recently?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with the `compare' utility

Post by fmw42 »

It was added sometime shortly after 6.5.0.9 (according to the changelog http://www.imagemagick.org/script/changelog.php) when the compare program was modified to allow locating the best match for a small image within a larger one. Prior to that I believe that compare may not have had this issue. Adding the -dissimilarity-threshold, probably will be ignored, but I cannot say for sure.
pnorcks

Re: Problem with the `compare' utility

Post by pnorcks »

fmw42 wrote:It was added sometime shortly after 6.5.0.9 (according to the changelog http://www.imagemagick.org/script/changelog.php) when the compare program was modified to allow locating the best match for a small image within a larger one. Prior to that I believe that compare may not have had this issue. Adding the -dissimilarity-threshold, probably will be ignored, but I cannot say for sure.
Thank you for your response. That's all I needed to know.
Post Reply