compare one image with the Image Directory

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
Sloneny
Posts: 1
Joined: 2015-08-30T01:17:28-07:00
Authentication code: 1151

compare one image with the Image Directory

Post by Sloneny »

Hello.
Please tell me whether ImageMagick to compare one image with several images in the catalog.
I need to compare 9 images in the same directory with a few hundred in the other, using the command line.
I have tried so, but it does not work:
compare -metric MAE D: \ test.png D: \ testfolder null:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: compare one image with the Image Directory

Post by fmw42 »

Sloneny wrote: compare -metric MAE D: \ test.png D: \ testfolder null:

You cannot compare one image to a folder of images with the compare function. It only compares two images at a time. So you would need to write a script to loop over all the images in the directory and compare each to one of your 9 images. Then repeat for each of the other 8 images.

Also you cannot have spaces in paths.

So I believe your command for any two images should be

Code: Select all

compare -metric MAE D:\test.png D:\testfolder\image1.png null:
That assumes that test.png (one of nine) is at the root of the D directory and image1.png (one of your 500 images) is in testfolder, which is at the root of the D directory.
Post Reply