Karl
Karl

Reputation: 51

Use of image magick compare command - how to catch the integer result of different pixels?

I am using this command line

compare -metric AE -fuzz 5% $OLD_JPG_ProcessFILE $JPG_ProcessFILE  /tmp/JPG_PathFullFillName.gif

The command does work and throws me the result as an integer number of different pixels into the next command line of Putty - but I can't assign this integer value to a bash variable ...!

How to do that?

This command

    var=$(compare -metric AE -fuzz 5% $OLD_JPG_ProcessFILE $JPG_ProcessFILE  /tmp/JPG_PathFullFillName.gif)

does not work, $var remains empty ...!

Thanks in advance and BR

Upvotes: 1

Views: 175

Answers (1)

Karl
Karl

Reputation: 51

Testing around I have found the answer by appending "null: 2>&1" :

    Pixel_Difference=$(compare -metric AE -fuzz 5% $OLD_JPG_ProcessFILE $JPG_ProcessFILE  /tmp/JPG_PathFullFillName.gif null: 2>&1)

Works fine!

But why - what is the "magic" behind with "null: 2>&1" ???

Upvotes: 2

Related Questions