possible bug compare IM 6.9.9.33 and IM 7.0.7-21

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug compare IM 6.9.9.33 and IM 7.0.7-21

Post by fmw42 »

If I try to compare two different size images with subimage-search in the wrong order, I get a proper error message.

Code: Select all

compare -metric rmse -subimage-search rose: logo: diff.png
compare: width or height exceeds limit `ROSE' @ error/cache.c/OpenPixelCache/3905.

But if I leave off the -subimage-search, I thought it should give a message that the two images are not the same sizes. But it seems to try to match the smaller first image with some (possibly the last) part of the larger second image.

Code: Select all

compare -metric rmse rose: logo: diff.png
45304.5 (0.691302)

Switching order also works.

Code: Select all

compare -metric rmse logo: rose: diff.png
45304.5 (0.691302)

I was under the impression that the above should fail without the -subimage-search. Am I mistaken? If it does work, which match is it using when the smaller image is first. And likewise how is it matching when the smaller image is second?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug compare IM 6.9.9.33 and IM 7.0.7-21

Post by magick »

If images to compare are different sizes, the comparison still completes utilizing virtual pixels. Older versions of ImageMagick would instead throw an exception if the images were not the same size.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug compare IM 6.9.9.33 and IM 7.0.7-21

Post by fmw42 »

magick wrote: 2018-01-07T15:54:12-07:00 If images to compare are different sizes, the comparison still completes utilizing virtual pixels. Older versions of ImageMagick would instead throw an exception if the images were not the same size.
So the result will get different results depending upon the virtual pixel method and in no case will it give the same match as if the proper subsections were used? Is that correct? Seems to me that this is confusing and gives the user a false sense of a good match.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug compare IM 6.9.9.33 and IM 7.0.7-21

Post by magick »

Comparing image of different sizes can be useful. Assume a reference image and a cropped version of the reference image. When compared, they might have minimum distortion suggesting they are similar. If two images of drastically different sizes are compared, it will return a high level of distortion indicating the images are not similar. Any confusion to the user can be abated by improving the compare program documentation.
Post Reply