how to display db value of ImageMagick 6.3.4's compare

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
joel_tan

how to display db value of ImageMagick 6.3.4's compare

Post by joel_tan »

i means that how to calculate the db value two different versions of the "same image" indicate how big is difference. Given that compare is used to compare two different versions of the *same image*, and produces a number not only a different image that represents what changed from version to version of the same image,
following is the log info :

bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png tmp.png
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 0b-36643.png tmp.png
0 (0)
bash-3.2# compare -channel red -metric MAE 0b-36643.png 3a-33504.png tmp.png
compare: image size differs `0b-36643.png'.

the tmp.png can be created but the db value cann't be retrieved in the Solaris
thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to display db value of ImageMagick 6.3.4's compare

Post by fmw42 »

joel_tan wrote:i means that how to calculate the db value two different versions of the "same image" indicate how big is difference. Given that compare is used to compare two different versions of the *same image*, and produces a number not only a different image that represents what changed from version to version of the same image,
following is the log info :

bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png tmp.png
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 0b-36643.png tmp.png
0 (0)
bash-3.2# compare -channel red -metric MAE 0b-36643.png 3a-33504.png tmp.png
compare: image size differs `0b-36643.png'.

the tmp.png can be created but the db value cann't be retrieved in the Solaris
thanks
if the images have the same width and height, values are returned to the terminal if tmp.png is replaced with null:

compare -metric MAE 0b-36643.png 3a-33504.png null:


see Comparison Statistics section on page http://www.imagemagick.org/Usage/compare/#compare
joel_tan

Re: how to display db value of ImageMagick 6.3.4's compare

Post by joel_tan »

following is the output in command line :

bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png null
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png x:
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png miff:- | display
display: unable to open X server `'.
compare: image size differs `0b-36643.png'.

i also don't get the db value using the compare command . how can i do this ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to display db value of ImageMagick 6.3.4's compare

Post by fmw42 »

joel_tan wrote:following is the output in command line :

bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png null
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png x:
compare: image size differs `0b-36643.png'.
bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png miff:- | display
display: unable to open X server `'.
compare: image size differs `0b-36643.png'.

i also don't get the db value using the compare command . how can i do this ?

You left off the colon ":" at the end of null:

I do not know what db means for you? Do you mean decibels? MAE only give mean absolute error. If you want decibels, you need to use PSNR

Also are you sure the images are exactly the same size in width and height (and also the same number of channels --- is one grayscale and the other truecolor?)

convert 0b-36643.png -format "%w x %h" info:
convert 3a-33504.png -format "%w x %h" info:

check to be sure they both give the same result for width x height
joel_tan

Re: how to display db value of ImageMagick 6.3.4's compare

Post by joel_tan »

thanks for your help
db value means decibels value

following is the output from compare command:
bash-3.2# convert 0b-36643.png -format "%w x %h" info:
414 x 297
bash-3.2# convert 3a-33504.png -format "%w x %h" info:
417 x 297
bash-3.2# compare -metric MAE 0b-36643.png 3a-33504.png null:
compare: image size differs `0b-36643.png'.

do you mean that the images compared must have the exactly same width and height?
if not , can i get the decibels value?, if so , how can i do this ?
thanks a lot
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: how to display db value of ImageMagick 6.3.4's compare

Post by anthony »

joel_tan wrote:do you mean that the images compared must have the exactly same width and height?
if not , can i get the decibels value?, if so , how can i do this ?
thanks a lot
As the pixels are compared directly, IM must know which pixels match which pixels. It can only do this if the images are the same size.

So...
Either you crop a image from identical marker points
Or you size the two images to identically sized images (typically smaller thumbnails for speed of comparing LOTS of images).

PSNR does produce a decibell output. with 0 bein identical and a large number being very different. However as the average of each image is subtracted from each pixel before they are compared, two solid color images of different colors will match identically.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
joel_tan

Re: how to display db value of ImageMagick 6.3.4's compare

Post by joel_tan »

thanks, i can do it by this way


bash-3.2# convert 3a-33504.png -resize 414x297! 3a-33504-tmp.png
bash-3.2# compare -metric PSNR 0b-36643.png 3a-33504-tmp.png tmp2.png
23.6006
Post Reply