π« The Pain Point
You have the same photo in multiple resolutions, crops, and slight edits. Simple hash comparison wonβt catch these βnear duplicatesβ because the bytes are different.
π Agentic Solution
An AI-Powered Similarity Detector that finds visually similar images, not just identical ones.
Key Features:
- Multiple Algorithms: Average hash, Perceptual hash, Difference hash.
- Adjustable Threshold: Control how similar images need to be to match.
- Visual Comparison: Side-by-side preview of similar pairs.
βοΈ Phase 1: Commander (Quick Fix)
For finding similar images.
Prompt:
βI have a folder
photoswith near-duplicate images. Write a Python script using imagehash to:
- Hash Method: Use perceptual hash (phash).
- Similarity: Find images with Hamming distance < 10 (adjustable).
- Report: Group similar images and print paths.
- Dry Run: List only;
--deleteto remove extras (keep largest file).Print progress. Show similarity scores. Handle corrupt images gracefully.β
Result: A truly clean photo library with no visual duplicates.
ποΈ Phase 2: Architect (Permanent Tool)
For Professional Photographers.
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create an "Advanced Image Similarity Finder".
**Requirements:**
1. **GUI:**
* Select folder.
* Algorithm dropdown (aHash, pHash, dHash).
* Threshold slider (0-64 Hamming distance).
* Side-by-side comparison viewer.
* Batch selection for deletion.
* Progress bar with ETA.
2. **Logic:**
* Pre-calculate all hashes (cache for speed).
* Compare all pairs (optimize with spatial indexing).
* Keep highest resolution by default.
* Move deleted to Recycle Bin.
3. **Deliverables:**
* `advanced_dedup.py`
* `run.bat`, `run.sh`
* `requirements.txt`
π§ Prompt Decoding
- Hamming Distance: The number of bits that differ between two hashes. Lower = more similar. 0 = identical.
π οΈ Instructions
- Install:
pip install imagehash - Copy Prompt β Run.
- Adjust threshold to catch more or fewer matches.