Command line Compare 2 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
mariosserhan

Command line Compare 2 images

Post by mariosserhan »

Hi there

Image Magick is indeed a great software with many many feautures.

I am trying for some weeks now to find a way to compare 2 images
in command line and instead of returning me the comparison image
i want to return me the percentage of similarity of these 2 images but without
luck.

Does anybody know if this is doable and maybe show us a command tip??
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Command line Compare 2 images

Post by snibgo »

See the documentation on "compare", eg

Code: Select all

compare -metric RMSE first.png second.png NULL:
will return a numerical measure of the difference between the two frames. Higher numbers are more different.

Can you define exactly what you mean by "percentage of similarity"?
snibgo's IM pages: im.snibgo.com
mariosserhan

Re: Command line Compare 2 images

Post by mariosserhan »

Hi snibgo Thanks for answering

Sorry for not being very straight with my answer.
What i mean is if there is a command that will take as input 2 images
and will return a percentage of how much they are similar
meaning 2 identical images as input will return a 100 or something output

I answered before checking out your suggestion just for making clear
what i mean, i am going to check out your suggestion :)

Thanks Again
Marios
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Command line Compare 2 images

Post by snibgo »

I understand that 100% means the images are identical. But I don't know what you want 50% or 0% to mean.

The command above will return zero when the images are identical.
snibgo's IM pages: im.snibgo.com
mariosserhan

Re: Command line Compare 2 images

Post by mariosserhan »

I just used the command you posted me and it actually works great it compares
the 2 images and it returns a number that i wanted (i dont know if its a percentage
but i dont realy care) now i am going to make some test to see what exactly these
numbers are, you said that 0 are identical above, then the bigger the number the
more the distance between the 2 images, so i have something to work now.

Thanks a lot :D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Command line Compare 2 images

Post by fmw42 »

see compare statistics at the bottom of this page http://www.imagemagick.org/Usage/compare/#compare
mariosserhan

Re: Command line Compare 2 images

Post by mariosserhan »

thanks fmw42 that was helpfull
it has realy good staff for me there
susamcsx
Posts: 1
Joined: 2015-10-15T23:43:29-07:00
Authentication code: 1151

Re: Command line Compare 2 images

Post by susamcsx »

mariosserhan wrote:I just used the command you posted me and it actually works great it compares
the 2 images and it returns a number that i wanted (i dont know if its a percentage
but i dont realy care) now i am going to make some test to see what exactly these
numbers are, you said that 0 are identical above, then the bigger the number the
more the distance between the 2 images, so i have something to work now.

Thanks a lot :D

hello,how about your result of the number,i have the same question with you
Post Reply