Comparing different-sized images

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Comparing different-sized images

Post by Drarakel »

It doesn't seem to work fully in IM v6.6.3-5.
The "-subimage-search" option now gets recognized. But "compare" still does the subimage-search per default. So, it seems that there's no difference at the moment with or without that option?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

Drarakel wrote:It doesn't seem to work fully in IM v6.6.3-5.
The "-subimage-search" option now gets recognized. But "compare" still does the subimage-search per default. So, it seems that there's no difference at the moment with or without that option?

Works for me on IM 6.6.3.4 Q16 (HDRI) Mac OSX Tiger


compare -metric rmse mandril3.png mandril3_156_22.png mandril_sim.png
compare: image size differs `mandril3.png' @ error/compare.c/CompareImageChannels/155.

compare -metric rmse -subimage-search mandril3.png mandril3_156_22.png mandril_sim.png
0 (0) @ 156,22
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Comparing different-sized images

Post by Drarakel »

Ah, now I see. It seems that the subimage-search is still done partially - but at the end, there's the "image size differs" message instead of the 'normal' results. Was this the intended behaviour?

Can you try it with the bigger images from my first post?

Code: Select all

convert -depth 8 -size 1000x1000 xc:yellow2 y2.png
convert -depth 8 -size 502x505 xc:yellow3 y3.png
compare -metric RMSE y2.png y3.png test.png
Here, I can't wait for the "image size differs" message to come and have to abort the process.
Running with IM v6.6.3-5 Q16, Windows XP. (With the Windows binary of v6.6.3-4, the new option wasn't recognized yet.)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

Drarakel wrote:Ah, now I see. It seems that the subimage-search is still done partially - but at the end, there's the "image size differs" message instead of the 'normal' results. Was this the intended behaviour?

Can you try it with the bigger images from my first post?

Code: Select all

convert -depth 8 -size 1000x1000 xc:yellow2 y2.png
convert -depth 8 -size 502x505 xc:yellow3 y3.png
compare -metric RMSE y2.png y3.png test.png
Here, I can't wait for the "image size differs" message to come and have to abort the process.
Running with IM v6.6.3-5 Q16, Windows XP. (With the Windows binary of v6.6.3-4, the new option wasn't recognized yet.)

Sorry I had not gone back to the previous page to see your messages. But running your command, it does seem like the test is delayed til the end and should test for image sizes right at the beginning before starting the compare process. This is on Mac OSX Tiger G4 PowerPC (kind of old).

Sorry I aborted after 35 minutes waiting to finish or give error message.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Comparing different-sized images

Post by magick »

We can reproduce the problem. Look for a patch in ImageMagick 6.6.3.6 Beta by sometime tomorrow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

magick wrote:We can reproduce the problem. Look for a patch in ImageMagick 6.6.3.6 Beta by sometime tomorrow.
In IM 6.6.3.6 Q32 HDRI Mac OSX Tiger, the following does not give an error message as was intended about the sizes being dissimilar, but does not produce the output either.

convert -depth 8 -size 1000x1000 xc:yellow2 y2.png
convert -depth 8 -size 502x505 xc:yellow3 y3.png
compare -metric RMSE y2.png y3.png test.png

Same result in Q16 non-hdri
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Comparing different-sized images

Post by Drarakel »

I can't test it on Windows - as the Windows binaries contain version 6.6.3-5 at the moment.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Comparing different-sized images

Post by magick »

Correct, we'll release the updated Windows binaries in a day or two.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

magick wrote:Correct, we'll release the updated Windows binaries in a day or two.
Not sure you saw my message above, but there are no error messages. Will that be fixed in 6.6.3.7?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Comparing different-sized images

Post by magick »

We can reproduce the problem you posted and will have a patch in ImageMagick 6.6.3-7 Beta by sometime tomorrow. Thanks.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Comparing different-sized images

Post by Drarakel »

On my system (IM v6.6.3-7, Windows XP), compare works good now - with and without the new option.
Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

Same for me on Mac OSX Tiger IM 6.6.3.7 (HDRI)

compare -metric RMSE y2.png y3.png test.png
compare: image widths or heights differ `y2.png' @ error/compare.c/CompareImageCommand/950.

Aborts right away now with the error message.



HOWEVER, now I need to modify my scripts that use it to do subimage searches. If I have an old release that was prior to the change, what will happen if I include -subimage-search in the command line? Will it just ignore it or will it abort with an error about unknown command?

I don't have a handy old release to test, but if this cannot be answered without, I will go back to the archives and get one.

If it needs trapping, then there were several releases where it was implemented and did not work correctly. Is there some better way to trap on this command than using the IM version number or testing for the existence of the command -subimage-search?
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Comparing different-sized images

Post by Drarakel »

I can't help you there - but just to confirm your thoughts:
fmw42 wrote:will it abort with an error about unknown command?
With my older IM versions, it's like that (and returns with an exitcode of 1 - at least on Windows). So, the normal behaviour with "unrecognized" options.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Comparing different-sized images

Post by fmw42 »

Drarakel wrote:I can't help you there - but just to confirm your thoughts:
fmw42 wrote:will it abort with an error about unknown command?
With my older IM versions, it's like that (and returns with an exitcode of 1 - at least on Windows). So, the normal behaviour with "unrecognized" options.
I will just go with using the IM version and ignore those interim releases.
Post Reply