HdWDedupEngine
HdWDedupEngine is a reusable Python library for detecting duplicate and near-duplicate images. It provides the shared engine used by DedupTool and ChronoName, without depending on their GUIs or source trees.
- Distribution:
hdw-dedup-engine - Python import:
hdw_dedup_engine - Current version:
0.1.0 - Requires: Python 3.10 or later
- License: MIT
Features
- Perceptual matching using dHash, with pHash and wHash corroboration.
- Optional exact-file hashing and SSIM checks.
- Duplicate clustering and keeper selection.
- CSV and HTML reports.
- Separate quarantine/trash actions with dry-run support.
- Optional incremental indexing, progress callbacks and cancellation.
Scanning produces a plan; moving files is a separate action controlled by the calling application. Applications also own their settings, report and cache paths.
Local installation
From this repository:
py -3 -m pip install -e .
Or install directly from another project:
py -3 -m pip install -e D:\Coding\HdWDedupEngine
The package is not assumed to be available on PyPI. No DedupTool checkout or
global PYTHONPATH setting is needed.
Core dependencies are NumPy and Pillow. Optional extras are:
| Extra | Capability |
|---|---|
heic |
HEIC decoding through pillow-heif |
ssim |
SSIM through scikit-image |
trash |
Operating-system trash through send2trash |
full |
All three optional capabilities |
dev |
Tests and distribution build tools |
For example:
py -3 -m pip install -e ".[heic,trash,dev]"
Basic usage
This example analyzes a folder and writes a CSV report without moving images:
import os
from pathlib import Path
from hdw_dedup_engine import (
DedupConfig,
DedupRunOptions,
load_settings,
plan_duplicates,
write_csv,
)
root = Path(r"D:\Photos\TestCollection").resolve()
reports = root / "Duplicate Reports"
settings = load_settings()
# Make the application-owned report location explicit and exclude it from scans.
settings.setdefault("reports", {})["base_dir"] = os.path.normcase(str(reports))
settings.setdefault("scan", {}).setdefault("exclude_roots", []).append(str(reports))
result = plan_duplicates(DedupRunOptions(
roots=[root],
config=DedupConfig(),
settings=settings,
log=print,
))
print(f"Scanned {result.files_scanned} images; {result.cluster_count} clusters")
print(f"Keep: {len(result.keep_paths)}; duplicates: {len(result.drop_paths)}")
write_csv(result.raw_summary, str(reports / "duplicates.csv"), [str(root)])
Review the plan before using execute_moves. Its default is dry_run=True;
actual moves require explicitly setting dry_run=False. HTML reports use
write_html with the same raw summary. Quarantine destinations preserve relative
paths and avoid overwriting existing files.
Public API
Import application-facing APIs from the package root:
DedupConfig,DedupRunOptions,DedupPlanResultplan_duplicates,create_engine,DedupEngineevaluate_pair,MatchEvidenceload_settings,write_csv,write_html,execute_moves
Scan progress callbacks receive (done, total, phase). Action progress callbacks
receive a single percentage from 0 to 100. Cancellation callbacks return a boolean.
Advanced consumers can supply an IndexDB from hdw_dedup_engine.index_db; its
lifetime and storage location remain the caller's responsibility.
Tests and distribution builds
py -3 -m pip install -e ".[dev]"
py -3 -m pytest -v
py -3 -m build
Build artifacts are written to dist/. The regression suite currently contains
79 tests; optional-dependency tests may be skipped when their extras are absent.
Integration notes
Version 0.1.0 retains the existing duplicate-matching and keeper policies.
load_settings chooses the working-directory settings file in source mode and
the executable-directory settings file when frozen; its supplied path argument
is currently ignored. Consumers should supply explicit absolute report/cache
paths and exclude their output directories. Windows report paths should be
normalized with os.path.normcase.
For PyInstaller applications, collect hdw_dedup_engine and the optional
dependencies the application uses. GUI resources and other external tools are
packaged by the consuming application.
Metadata
Release files for hdw-dedup-engine 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hdw_dedup_engine-0.1.0.tar.gz | 36.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hdw_dedup_engine-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.0 kB
Release files / hdw_dedup_engine-0.1.0.tar.gz
| Download URL | hdw_dedup_engine-0.1.0.tar.gz |
|---|---|
| Size | 36.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0615f199ff9046e0cf94a9e8c9b31141d6fa45c2c9b47a6e81b26255529ad87e
|
|
BLAKE2b-256 checksum How to use checksums |
79c3ba0292162f9ffe7db8db3ae5de5ef01768408c9fc91c7bc464931ee6deb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / hdw_dedup_engine-0.1.0-py3-none-any.whl
| Download URL | hdw_dedup_engine-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bde2ad3d14332b73795c06b1ae81bcf07d7984cec884059bf1b928407e2ca3a
|
|
BLAKE2b-256 checksum How to use checksums |
9eb8de575d9c95978bccb41df3e7822f3d62f439f9c7ddad69ad23d518a9cfaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|