IM review | compare

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
User avatar
rengel
Posts: 4
Joined: 2013-07-30T05:59:26-07:00
Authentication code: 6789

IM review | compare

Post by rengel »

There are nine metrics implemented. This is very handy and one may only wonder, why the compare function does not work with only two or maybe beyond referenced metrics only with one image.

Concentrating on referenced metrics (i.e. compare A with B) it might be nice, not to be forced to write a third image, but to get the measurement result for other purposes. This both is not possible at this time or I stood on my own feet.

This works & pipes the output of the "-list filter" option to a text-file

Code: Select all

convert -list filter >file.txt
This returns a blank text-file

Code: Select all

compare -verbose -metric PSNR IMAGE-A IMAGE-B IMAGE-C >file.txt
On the page http://www.imagemagick.org/script/comma ... ptions.php is a small spelling irritation with "-list metrics" and not "-list metric". But that is a tine one, that's true :D

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

Re: IM review | compare

Post by fmw42 »

it might be nice, not to be forced to write a third image
Just use null:

compare -metric rmse imageA imageB null:


You need to send the result to std error, but I am not sure why this does not work

compare -metric rmse rose: rose: null: 2>&1 >tmp.txt

But you can put the result into a variable

val=`compare -metric rmse rose: rose: null: 2>&1`
echo $val
0 (0)

If you want to write to a file, then you can send the variable to a file

echo $val > tmp.txt


You can combine the two by

echo `compare -metric rmse rose: rose: null: 2>&1` > tmp1.txt
User avatar
rengel
Posts: 4
Joined: 2013-07-30T05:59:26-07:00
Authentication code: 6789

Re: IM review | compare

Post by rengel »

Thank you for your useful hints concerning redirections. I followed your instructions and found this line suitable for me.

Code: Select all

compare -verbose -metric PSNR IMAGE-A IMAGE-B null 2>im-metric-PSNR.txt
My problem, especially when calling from other apps, is the STDOUT returning nothing and the information I'm looking for is returned as STDERR.
Post Reply