4 releases

0.2.0 Feb 4, 2024
0.1.2 Feb 13, 2023
0.1.1 Feb 10, 2023
0.1.0 Feb 10, 2023

#244 in Images

46 downloads per month

AGPL-3.0

14KB
273 lines

dupimg

A simple duplicate image finder.

Summary

Checks the similarity between two images, using the SSIM algorithm implemented by dssim-core. Works on JPG and PNG images of any size by first rescaling them to 200x200 internally.

Runs multithreaded, every image is checked against every other one and there is no heuristic for e.g. finding likely candidates early, so while this is somewhat optimized, checking many files will likely still be very slow.

Note: I am rather inexperienced with Rust, so there will definitely be some dumb code here.

Installation

Either run cargo install dupimg, or clone this repository and run cargo install --path . from the project root.

Basic usage

dupimg [-r directory1/ directory2/ ...] file1.jpg file2.png ...

Output format

<IMAGE 1>       # path to first image
<IMAGE 2>       # path to second image
  SSIM: 0.0...  # positive and unbounded; lower values indicate a closer match

Threshold

The threshold for displaying a match may be set by e.g. -t 0.01. Only matches with a SSIM smaller or equal to this threshold will be displayed.

The default is 0.1, as this tends to give good results with very few false positives.

Recurse

-r may be specified to enable traversing specified directories.

When recurse is enabled, only PNG and JPG files will be checked. This also applies to filenames specified on the command line.

For additional information, see dupimg --help.

Note

All program output is unsorted and unstable, do not rely on it.

Credits

All code in this crate was written by myself.

All credits for libraries used go to their respective authors.

Dependencies

~18–28MB
~218K SLoC