Find & remove duplicate/near-duplicate images using perceptual hashing (PHash, AHash, DHash, WHash) and CNN embeddings. Use when deduplicating image datasets or comparing image similarity in python. Libraries: imagededup and imagehash
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Find & remove duplicate/near-duplicate images using perceptual hashing (PHash, AHash, DHash, WHash) and CNN embeddings. Use when deduplicating image datasets or comparing image similarity in python. Libraries: imagededup and imagehash
Image Deduplication (Python)
Two complementary libraries: imagededup (idealo) for batch directory deduplication with hashing + CNN, and imagehash (JohannesBuchner) for standalone perceptual hashing including color and crop-resistant hashes.
Don't use CNN for exact duplicates — hashing is orders of magnitude faster and equally accurate for byte-identical or near-identical images.
Don't set max_distance_threshold too high — values above 20 produce excessive false positives. Start at 10 and increase gradually.
find_duplicates_to_remove uses a greedy heuristic — it may keep different "originals" depending on traversal order. For fine-grained control, use find_duplicates and apply your own dedup logic.
imagededup's CNN downloads a model on first use — MobileNetV3 by default. Ensure internet access or pre-download.
crop_resistant_hash returns a multi-hash — you cannot compare it with == against regular ImageHash objects. Use its .matches() method or convert via hex_to_multihash.