Compare multipage tiff

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Currently Im comparsions only work with two images at a time. If fact attempting multi-image iages would probably result in the first time images of the first file being compared, not the first image from each file.

I do have some plans for a future -layers function that merges pairs of 'shuffled' images using alpha composition as a means of merging GIF animations. This could be used get convert two multi-image files into a single multi-image 'difference' file. however I have been busy with other things, and have not gotten back to creating the shuffle, or the mutli-composition layers function. no ETA either, sorry.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ZAB
Posts: 5
Joined: 2013-05-21T14:14:33-07:00
Authentication code: 6789

Re: Compare multipage tiff

Post by ZAB »

Did multipage images comparison ever worked in imagemagick?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compare multipage tiff

Post by anthony »

actually yes...

Though not as I envisioned then above.

The operation is
-layers composition

See IM examples, Animation Modifications, Multi-Image Composition
http://www.imagemagick.org/Usage/anim_mods/#composite

For comparing images you would use 'difference' on the two sets of images.

For an example of that look at. the first example in
IM examples, Animation Modifications, Splitting up an Animation
http://www.imagemagick.org/Usage/anim_mods/#split

This compares a sequence of images with itself (shifted by one), and merged results.
That is create a mask of any difference between any image in the list.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ZAB
Posts: 5
Joined: 2013-05-21T14:14:33-07:00
Authentication code: 6789

Re: Compare multipage tiff

Post by ZAB »

I do not want to split animation into frames. I just want to compare two multipage tiffs. I tried to run "compare -metric PSNR multipage1.tif multipage2.tif diff.tif" and it fails. Even though both tiffs are equal IM shows 11.7 PSNR and diff.tif contains only one meaningless page.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compare multipage tiff

Post by anthony »

The pointer was not to what was being done, but to the compare (difference composite) aspect of that example.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ZAB
Posts: 5
Joined: 2013-05-21T14:14:33-07:00
Authentication code: 6789

Re: Compare multipage tiff

Post by ZAB »

Ok. Is there any way to compare multipage tiffs on a page by page basis? With a one line command.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compare multipage tiff

Post by anthony »

compare image_set_1.tiff null: image_set_2.tiff -compose differance -layers composite difference_image_set.tiff

Now the next step in how you want to 'examine the differences' is where metrics come in.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ZAB
Posts: 5
Joined: 2013-05-21T14:14:33-07:00
Authentication code: 6789

Re: Compare multipage tiff

Post by ZAB »

I am getting this error "compare.exe: unrecognized option `-layers' @ error/compare.c/CompareImageCommand/707."

But even if I remove -layers from command line, say "compare -metric psnr multipage.tif null: multipage.tif diff.tif", IM prints 11.0495 PSNR to standard output. I'ts not how it should work on identical multipage files. For identical files it should print 1.#INF. Or throw an error that multipage files are unsupported....
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Compare multipage tiff

Post by fmw42 »

compare image_set_1.tiff null: image_set_2.tiff -compose differance -layers composite difference_image_set.tiff
I think Anthony may have meant

convert image_set_1.tiff null: image_set_2.tiff -compose differance -layers composite difference_image_set.tiff

Then you must analyze the difference image to get some metric for the difference such as the average or mean or rmse over the image
ZAB
Posts: 5
Joined: 2013-05-21T14:14:33-07:00
Authentication code: 6789

Re: Compare multipage tiff

Post by ZAB »

Ok... It will be a second command line but how to calc PSNR of this diff image using only IM?

Comparing multipage images is a real usecase! Now IM silently compare first two pages of a first tiff file... or last two pages of a second file... whatever... it is a bug. Should I fill an issue in the issue tracker?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compare multipage tiff

Post by anthony »

fmw42 wrote:I think Anthony may have meant
convert image_set_1.tiff null: image_set_2.tiff -compose differance -layers composite difference_image_set.tiff

Yes.. Applogies. Brain thinking one thing, fingers typing another.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vinayzz
Posts: 9
Joined: 2018-10-10T02:23:01-07:00
Authentication code: 1152

Re: Compare multipage tiff

Post by vinayzz »

Any Update on the solution here?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Compare multipage tiff

Post by fmw42 »

vinayzz wrote: 2018-10-10T02:57:11-07:00 Any Update on the solution here?
This is an old post and a solution was given.

Please elaborate on your specific issue with examples and code. Or open a new topic.
Post Reply