Compare with threshold value?

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.
Post Reply
sven
Posts: 27
Joined: 2003-10-02T02:21:38-07:00

Compare with threshold value?

Post by sven »

Hi magick,

We're using the compare utility intensively and it works flawlessly. If a certain pixel in image A is different from the corresponding pixel in image B, the resulting pixel in image C will be overlayed with 90% magenta.

Now, we're wondering, if it is possible to consider a certain threshold value in order to neglect slight differences.

Example:
  • Image A and B are in CMYK colorspace
  • Pixel (x,y) of image A is C100, M100, Y100, K100
  • Pixel (x,y) of image B is C101, M100, Y100, K99
This would lead to a magenta-overlayed pixel in the resulting image C.
With a comparison threshold value of 1 you could define that a tolerance of +/- 1 for each color value is allowed. In this case image C would have a 90% white-overlayed pixel at this position.

Background of this question:
We have experienced slight color differences when having either the PowerPC or the Intel Mac architecture while using Adobe InDesign CS3 resp. QuarkXPress 7 and working with transparencies. Such problems can be reproduced, meaning that you have a document with transparencies in InDesign and create a PDF document using a PowerPC and then using an IntelMac. When you then compare these PDF documents, you will recognize magenta-colored pixels. Moreover, this is not a problem of the RIP (e.g. Ghostscript, Photoshop). You can prove that this problem already exists in the PDF document.
In addition to that I a sure that such comparison threshold value would be nice, since these color differences can only be measured but not be seen.

Thanks in advance for any feedback.

Kind regards,
Sven
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compare with threshold value?

Post by anthony »

At the moment compare only uses tresholds for counts of pixels differences.
It does not even use a -fuzz threshold for the generation of the 'difference' image.

Of course you could generate a threshold difference mask (see the compose method ChangeMask) to restrict what pixels you are interested in comparing (mask both images then compare).

See IM Examples, Composite, ChangeMask
http://imagemagick.org/Usage/compose/#changemask

and the rough notes on Image Comparing
http://imagemagick.org/Usage/compare/#compare
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply