compare 2 images

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
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

compare 2 images

Post by myspacee »

hello again :)

we have a production problem that can be resolved with comparing action.

post here 2 files (untouched) taken from our system :
alpha http://www.megaupload.com/it/?d=97JEXZOK
beta http://www.megaupload.com/it/?d=KH7C82HB

alpha is first file with all CMYK 'plates'
beta is single 'plate' (k - Black) ripped from alpha, with printer program

is there a manner to compare 2 images ?
(my idea is to level both file to similar format, and then compare them)

Any idea is appreciated,

m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: compare 2 images

Post by fmw42 »

for some reason I cannot see your images. But convert them to rgb and use the IM function compare

see
http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/#compare

compare rgbimage1 rgbimage2 diffimage

or

compare -metric XXX rgbimage1 rgbimage2 null:

where xxx is one of the metrics such as rmse, mae, etc
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

fmw thank you for reply.

2 images are very different .

alpha contain all CMYK, must be splitted, and resized to be compared with beta,
and you said, passed to RGB

Can you post different step of these task (maybe some code) ?

Thank you,

m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: compare 2 images

Post by fmw42 »

myspacee wrote:fmw thank you for reply.

2 images are very different .

alpha contain all CMYK, must be splitted, and resized to be compared with beta,
and you said, passed to RGB

Can you post different step of these task (maybe some code) ?

Thank you,

m.

It is really hard to know if I cannot see your images. What do you mean by split? If the images are not the same size and do not match relatively closely in position/content, then I am not sure what you expect from a comparison. If you can resize them to the same size and then they match closely, then you can get something meaningful.

How may we access your images?

If you need a single channel, you can do

convert image -channel Cyan -separate cyanimage

If you need to resize, then you can do

convert image -resize WidthxHeight resizedimage

see -resize, -channels, -separate at http://www.imagemagick.org/script/comma ... ptions.php
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

solve problem using different approach:

- load A image (tif)
- snapshot it -> bmp
- view B image (jpg)
- snapshot it -> bmp
-compare generated bmp using imagemagick and find differencies

realized this with Autoit and Imagemagick, find example code for XP machine :
http://www.autoitscript.com/forum/index ... =86232&hl=

thank you all for attention,

m.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

hello to all,
put in production tool with Imagemagick and all is very good.

Have a question. We compare 2 images with :

compare -fuzz 95% -metric PSNR alpha.tif beta.tif delta.png

________________ our producion delta.png :
Image

Is possibile to have ONLY differences for delta.png and not similar pixels ?

________________ desired delta.png:
Image

thamk you all for support and info,

m.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compare 2 images

Post by magick »

Use the -lowlight-color and -highlight-color options to modify how pixel differences are shown in the difference image. We suspect setting the lowlight color to something solid like 'white' will do what you want.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

perfect, thank you.

m.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

thank you again, but i've another question.

_______________ this is final command
compare -fuzz 95% -metric PSNR -lowlight-color white alpha.tip beta.tif delta.png
15.7329


15.7329 is differences return in number. Can you explain what this number is ? (%?)

there is a way to save this value in a system variables or in a text file ?
(try redirect output to file [ command > c:\result.txt] without luck)


thank you,

m.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compare 2 images

Post by magick »

See http://en.wikipedia.org/wiki/PSNR for a description of peak signal to noise ratio.

The PSNR is written to stderr. There is way to redirect stderr to a file under Windows and its been mentioned on the discussion server a couple of times. Use the search button above or check with Google. We would help but we're Linux geeks, not Windows.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: compare 2 images

Post by el_supremo »

Use:
command 2>c:\result.txt

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: compare 2 images

Post by myspacee »

thank you.

m.
Post Reply