Page 1 of 1
How to use both convert and compare in one command?
Posted: 2009-04-16T18:57:22-07:00
by mattalexx
I would like to use convert to resize an image to the size of another image before I use compare to compare them. I want to do this in one command so I can avoid saving a temp file from convert to use in compare.
I wish I wasn't so bad with standard output and stuff like that. Is there anyway to accomplish what I'm after?
Thanks.
Re: How to use both convert and compare in one command?
Posted: 2009-04-16T19:27:27-07:00
by fmw42
This does not work as compare does not seem to allow parenthesis processing and objects to -resize
compare -metric rmse image1.jpg \( image2.jpg -resize WIDTHxHEIGHT \) null:
But you can do this by piping the output from convert (as temporary miff file that automatically goes away) to compare.
convert image2.jpg -resize WIDTHxHEIGHT miff:- | compare -metric rmse - image1.jpg null:
Re: How to use both convert and compare in one command?
Posted: 2009-04-18T16:35:08-07:00
by mattalexx
fmw42 wrote:
convert image2.jpg -resize WIDTHxHEIGHT miff:- | compare -metric rmse - image1.jpg null:
Awesome, thanks!
Re: How to use both convert and compare in one command?
Posted: 2009-04-22T21:47:34-07:00
by anthony
Only convert and montage allows the use of parenthesis. and only compare allows the use of -metric.
You can get some compare handling in "convert" by using a "Difference" composition of the two images, but that is about as far as it goes.
http://www.imagemagick.org/Usage/compare/#difference