Imagemagick compare: "images too dissimilar"
Posted: Mon Aug 26, 2013 6:27 pm
[PROBLEM]
I tried to compare two images using ImageMagick's "compare", but always received the following error:
My version redirects stdout and stderr to /dev/null. The returned value of this call is just the number of pixels that differ.
This is necessary to use it in a BASH script.
[SOLUTION]
Older versions of imagemagick didn't check how different the image was, before running the actual pixel comparison.
There's a new parameter called "dissimilarity-threshold".
If the images you'd like to compare could be very very different, you might want to set it to 1:
Thanks to a forum-post by user "fmw42" on imagemagick.org.
I tried to compare two images using ImageMagick's "compare", but always received the following error:
The code has worked in the past, but it seems that the ImageMagick version got updated in the meantime to "ImageMagick 6.6.0-4 2012-05-03 Q16":compare: images too dissimilar `color_squares/b-b.png' @ error/compare.c/CompareImageCommand/926.
Code: Select all
compare -metric AE -fuzz 40% $IMAGE_1 $IMAGE_2 null: 2>&1 > /dev/null
This is necessary to use it in a BASH script.
[SOLUTION]
Older versions of imagemagick didn't check how different the image was, before running the actual pixel comparison.
There's a new parameter called "dissimilarity-threshold".
If the images you'd like to compare could be very very different, you might want to set it to 1:
Code: Select all
compare -dissimilarity-threshold 1 -metric AE -fuzz 40% $IMAGE_1 $IMAGE_2 null: 2>&1 > /dev/null