NOTE: This does not work anymore. I couldn't get it to run for most files anymore, it seems like this tool is broken.
There is Libpuzzle, that will do the comparison part, but not the search for all images part. To install it use the package libpuzzle-bin
, that will give you the command line tool.
It is a library and a command line tool that is designed for the purpose of comparing two images and listing their similarity. I used it to find files that were very similar (logos) a while ago, that worked well.
If you want to use it, you must use additional software that calls libpuzzle with the appropriate options.
I wrote a script that can be used for a find -exec command. The script goes like this (I have it in a file called simple-pd.sh
):
#!/bin/bash
if (( $(echo "0.80<`puzzle-diff \"$1\" \"$2\"`" | bc -l) )) ; then
exit 0
fi
exit 1
it is invoked like this:
find . -regex ".*jpg\|.*gif\|.*png" -exec ./simple-pd.sh MYIMAGE {} \; -print
where you replace MYIMAGE with the image you want to have the comparison on. The script needs executable rights (chmod +x simple-pd.sh
)
The tool (together with the scripts here) will do what you want most of the time.
While I do like the tool it has its downsides. It can't read all files (I had problems with jpgs sometimes) and is irritating when it fails.
The parameters for puzzle-diff
are hardly documented, you will need to test on some images that you want to have and some that you don't to see which ones are the best for your task.
My Script assumes that an image that is very similar (0.80) is to be reported as YES and the rest as NO. You might want to reduce that number to fit your needs.