Passing -Metric compare result to variable - IMAGEMAGICK image

Asked

Viewed 36 times

4

I’m comparing two images using Imagemagick on the LINUX terminal.

When I type in the Terminal line this (below) it returns a value to me:

$ compare -metric mae 0.jpg 2.jpg null:

But I can’t put this value in a variable to later make a comparison within a BASH Script. Below how I write and give me error (or better: The variable is still empty and the value is still on the screen):

var=`compare -metric mae 0.jpg 2.jpg null:`

even so:

var=$(compare -metric mae 0.jpg 2.jpg null:)

When I type: echo $var nothing comes out! Someone help me?

As a step to a variable the value of a COMPARE -METRIC?

  • Try var=$(compare -metric mae 0.jpg 2.jpg null: 2>&1)

  • Thanks Valdeci!!! That’s right! It was missing the 2>&1 .... Now it works perfectly!!!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.