compare -metric PSNR, return code always 1

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
notpeter
Posts: 1
Joined: 2016-07-28T15:06:53-07:00
Authentication code: 1151

compare -metric PSNR, return code always 1

Post by notpeter »

With 6.8.6-10 (I think) 'compare' now provides a return code. From the man page:

Code: Select all

The compare program returns 2 on error otherwise 0 if the images are similar or 1 if they are dissimilar.
Running with '-metric PSNR', even if images are identical (same file) 'inf' is correctly printed to stderr but the the return code is always 1.

Code: Select all

compare -metric PSNR image1 image2 image_diff_output
Steps to reproduce (works with any jpg, png, svg, etc)

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 $?
Image

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compare -metric PSNR, return code always 1

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
Post Reply