ImageMagick compare executable: unrecognized option `-metric' @ error/convert.c/ConvertImageCommand/2060
Asked Answered
S

2

0

I tried to use apt-get install imagemagick command to install ImageMagick on my Debian Wheezy. But when I try to diff images, I get following error:

root@work:/home/tests/YAML_SHOTS/en-us# convert 1.png 2.png -metric RMSE -compare 3.png
convert.im6: unrecognized option `-metric' @ error/convert.c/ConvertImageCommand/2060.

Secondly, I tried to install ImageMagick from binary source (described here: http://www.imagemagick.org/script/install-source.php#unix). But it does not install the convert executable command.

How can I fix that?

P.S. If I remove -metric option, I get one more error:

convert.im6: unrecognized option `-compare' @ error/convert.c/ConvertImageCommand/1107.
Shantelleshantha answered 27/10, 2014 at 13:25 Comment(4)
What's the output of identify -list metric?Insurmountable
What's the output of convert -version?Gypsie
@Insurmountable AE Fuzz MAE MEPP MSE NCC PAE PHASH PSNR RMSEShantelleshantha
@KurtPfeifle (compiled) ImageMagick 6.8.9-9 Q16 x86_64 2014-10-27 and i've also tried to install 6.7.7.10-5+deb7u3 via apt-get install imagemagickShantelleshantha
I
2

Use the compare utility directly.

compare 1.png 2.png -metric RMSE 3.png

But if you want to generate a image diff without sending the metrics to STDERR, define the -metric and -compare before the image stack.

convert -metric RMSE -compare 1.png 2.png 3.png
Insurmountable answered 27/10, 2014 at 13:35 Comment(0)
G
2

Assuming your ImageMagick version is a fairly recent one, try this command:

 compare -metric phash 1.png 2.png delta.png

   7.61662

The returned pHash value of 7.61662 indicates, that there was indeed some difference in the compared image, and that the delta.png will show some red highlighted pixels.

The red pixels indicate there is a difference in the color values of the respective pixels in the two compared images. White pixels indicate identical color values. The grayed-out, light color background of the delta.png is derived from the first image, in order to help identify better the differences in more complex images. If you do not want the background, run this modified command:

 compare -metric phash 1.png 2.png -compose src delta.png

<code>1.png</code> (left), <code>2.png</code> (center) and <code>delta.png</code> (right)

Above illustration depicts 1.png (left), 2.png (center) and delta.png (right).

Compare this to

 compare -metric phash 1.png 1.png delta2.png

   0

Here there is no difference, the pHash value is 0, and the delta2.png doesn't show any red pixels:

<code>1.png</code> (left), <code>1.png</code> (center) and <code>delta2.png</code> (right)

Above illustration depicts 1.png (left), 1.png (center) and delta2.png (right).


By default, the compare command will run with 72 PPI. If you need a higher resolution (for example, when comparing PDF pages), add -density 300 as the first parameter to get 300 PPI.

Gypsie answered 20/11, 2014 at 18:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.