jhnc / findimagedupes

Finds visually similar or duplicate images
GNU General Public License v3.0
104 stars 8 forks source link

option: only equal size? #1

Closed zvezdochiot closed 4 years ago

zvezdochiot commented 4 years ago

For some tasks need to search for similar images with only the same size. Is such an optional modification possible? That is, to compare not the strings phash, but the strings (Width)x(Height):phash?

jhnc commented 4 years ago

The use-case of findimagedupes is finding similar images (which may include identical images which differ only by resolution), so limiting the program to a particular x-y resolution is out of scope.

You can partition your images yourself and then run findimagedupes on each batch separately. For example, in bash you could do something like:

# create a directory to store the lists of files
workdir=$(mktemp -d)

# get and store dimensions of images
find [...images/directories...] -type f -exec gm identify -format '%wx%h %f' '{}' \; 2>&- |\
while read -r dim file; do
    echo "$file" >> "$workdir/$dim"
done

# run findimagedupes on each batch
find "$workdir" -type f -exec bash -c 'findimagedupes [...optons...] < {}' \;

# tidy up
rm -r "$workdir"
jhnc commented 4 years ago

This sort of filtering will be simpler if/when I reimplement the fingerprint database using sqlite.