image-compare

Compares a collection of images against a target image, returns the image in the collection that closest resembles the target image.

IMAGE-COMPARE

Node.js utility to help you quickly identify which image from an array closest resembles a target image.

image-compare PATH-TO-TARGET-IMAGE [IMAGE, ...]

Returns the path of the closest resembling image.

For example:

image-compare 'test/img/01.jpg' 'test/img/02.jpg' 'test/img/03.jpg'

Will return text:

test/img/02.jpg
npm install image-compare

Image-compare is really a nice API sat between the command line and GraphicsMagick. It uses the GraphicsMagick compare method to create a number that represents the difference between the target image and each image in the array. Image-compare then returns the image that has the smallest amount of difference. GraphicsMagick.compare isn't a silver bullet, you can't get a 100% reliable comparison between images from it. The best way to work out which image from a collection closest resembles another image is to compare the size of difference.