A super-fast in-memory duplicate & similar image finder
Project description
difpy2
A super-fast, in-memory duplicate & similar image finder built on perceptual-hash bucketing and Numba-accelerated comparison.
Features
- Zero on-disk output: everything runs in RAM
- Exact & “similar” mode (custom MSE threshold)
- Perceptual-hash + histogram pre-bucketing to prune comparisons
- Numba-JIT mean-squared-error with early bailout
- Thread-pooled image loading & feature extraction
- CLI and Python API
Installation
pip install difpy2
Requires Python ≥ 3.12
Quickstart
CLI
bash
Copy
Edit
difpy2 \
-D /path/to/images \
--px_size 50 \
--bins 8 \
--sim 0.0 # exact duplicates only; use >0 for “similar” mode
Options
-D, --dirs … one or more image directories
-r, --recursive … recurse into subfolders
-px, --px_size … resize images to px×px for comparison
-b, --bins … per-channel histogram buckets
-s, --sim … MSE threshold (0.0 = exact only)
-t, --threads … number of worker threads
Python API
python
Copy
Edit
from difpy2 import DuplicateFinder
finder = DuplicateFinder(
directories=["/path/to/images"],
px_size=50,
hist_bins=8,
similarity=0.0, # exact duplicates
threads=4,
)
results, lower_quality, stats = finder.run()
# results: { primary_image_path: [[duplicate_path, mse], …], … }
# lower_quality: [all duplicate/similar image paths]
# stats: { total_files, featurized, groups, duration_s }
Project Layout
arduino
Copy
Edit
difpy2/
├── difpy_opt.py # core implementation
├── README.md
├── LICENSE.txt
├── pyproject.toml
└── …
Contributing
Fork the repo
Create a feature branch
Run tests & linters
Submit PR
License
This project is licensed under the MIT License. See LICENSE.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
difpy2-0.1.0.tar.gz
(5.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file difpy2-0.1.0.tar.gz.
File metadata
- Download URL: difpy2-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0a6c3cd81ac02e0dba0a4c1115afd55b15dde97bac65da58ad9542815221c22
|
|
| MD5 |
61179e5d8d41ab8264874ba51daa06ea
|
|
| BLAKE2b-256 |
16bcdf79b87d2c9a6a4fffd796f3c5293c18b09cc19cfd220c6069f8294bd737
|
File details
Details for the file difpy2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: difpy2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4525fe764d589a08ae1a7188489286a4493dc19367f122b808c846b6f04bd46d
|
|
| MD5 |
de557dba0291f588a5dd2cb49a330489
|
|
| BLAKE2b-256 |
2fb9f50e96585960c6d2b7707612f448c31bd5cd8b9945d8e492ec7fb22ddb13
|