Code: Select all
The compare program returns 2 on error otherwise 0 if the images are similar or 1 if they are dissimilar.
Code: Select all
compare -metric PSNR image1 image2 image_diff_output
Code: Select all
wget http://git.imagemagick.org/uploads/project/avatar/8/logo.jpg
compare -metric PSNR logo.jpg logo.jpg logo_diff.png
echo $?

I ran into this when upgrading from Ubuntu 14.04 (ImageMagick 6.7.7-10) to Ubuntu 16.06 (ImageMagick 6.8.9-9) and verified it's still an issue in ImageMagick 6.9.4-9 and I assume ImageMagick 7 as well.