I am looking for a program that can compare two images, and return the rate of similarity (e.g., in %).

Any license, price, and operating system is fine. I mostly interested in the quantity of the image similarity algorithm.

  • What do ypu define as similarity? (Roughly the) same colo(u)r pixel in (roughly) the same place? – Mawg says reinstate Monica Feb 22 '18 at 9:36
  • @Mawg ideally, the algorithm should match similarity as judged by humans, which I am aware is partly subjective – Franck Dernoncourt Feb 22 '18 at 16:07
  • Lol - make that entirely subjective :-) Can we try to define it? Roughly the same shapes/colo(u)rs in roughly the same places? I am hoping to get am answer to this question, btw – Mawg says reinstate Monica Feb 22 '18 at 20:53
  • Similarity as judged by humans sounds like a difficult research problem, not something you're going to find an accurate shrink-wrapped tool for. – Kodiologist Feb 26 '18 at 18:50
  • @Kodiologist some relatively subjective take such as automated summarization or content aware filling have some decently well packaged code/program taking care of it. – Franck Dernoncourt Feb 26 '18 at 20:08

You can see the difference of two images using imagemagick.

Use ImageMagick® to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, HEIC, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

imagemagick homepage

It works fine on Windows. See this answer at stackoverflow.com about comparing two images If the output is "1161" it's 50%. See @Mark Setchell's comment about his own answer.

@echo off
FOR /F %%G IN ('magick.exe compare -metric ae PATH_TO_YOUR_IMAGE\a.jpg PATH_TO_YOUR_IMAGE\b.jpg null:') DO @SET n=%%G 
echo %percent%

Save this file as "percent.bat" or whatever you like in the same directory of magick.exe. Run it on command line. (I had to add "magick.exe" above code)

Virustotal.Com results for executables are fine, I only tested setup program and magick.exe


I have developed an image comparison algorithm based on perceptual similarity, which you can try online on the web-site. The corresponding program function func Similar (Github code) contains 2 similarity metrics: 1) color distance. 2) cosine similarity. By merging the two into one equation you can get the perceptual similarity metric in %.

Current implementation is relatively strict on position/rotation/distortion etc. But by adding a sliding window with scale/position variations, it is possible to apply this algorithm to sub-regions, so that you can get a cumulative metric based on similarity of image parts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.