Compare specific region in two images

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
manmanda
Posts: 17
Joined: 2014-04-16T13:34:38-07:00
Authentication code: 6789

Compare specific region in two images

Post by manmanda »

Hello,
My question what is wrong with this command to compare specific region in both the images

convert pic1.bmp pic2.bmp -crop 40x30+10+10 +repage miff:- | compare pic1.bmp pic2.bmp compare.bmp

When i used above command crop didn't happen and compare.bmp is created which compared the whole image not specific resion.

One more question can i used composite command with convert command also?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Compare specific region in two images

Post by fmw42 »

your pipe needs to us "-" to receive the miff:- data. The "-" will have two channels from miff:- and they will be treated as two images. Try

Code: Select all

convert pic1.bmp pic2.bmp -crop 40x30+10+10 +repage miff:- | compare - compare.bmp
But it is usual to specify a -metric for compare. I do not know what the default metric is.

Code: Select all

convert pic1.bmp pic2.bmp -crop 40x30+10+10 +repage miff:- | compare -metric rmse - compare.bmp
Post Reply