A .NET console application that finds duplicate and near-duplicate images using perceptual hashing.
- Scans a directory for image files (jpg, jpeg, png, gif, bmp, tiff, tif, webp)
- Uses difference hashing (dHash) to detect similar images
- Finds both exact duplicates and near-duplicates based on a configurable threshold
- Optionally creates Windows shortcuts to suspected duplicates for easy review
dotnet run <directory> [hammingThreshold] [targetDirectory]Parameters:
<directory>- Directory to scan for images (required)[hammingThreshold]- Hamming distance threshold for near-duplicates (optional, default: 4, range: 0-64)[targetDirectory]- Directory to create shortcuts for suspected duplicates (optional)
Examples:
dotnet run "C:\Photos"
dotnet run "C:\Photos" 2
dotnet run "C:\Photos" 4 "C:\Desktop\Duplicates"- Lists suspected duplicate pairs with their Hamming distance
- Shows file paths and sizes
- Creates shortcuts in specified target directory for manual review (if provided)
Uses difference hashing (dHash) algorithm:
- Resizes images to 9x8 pixels
- Converts to grayscale
- Compares adjacent horizontal pixels
- Generates 64-bit hash
- Compares hashes using Hamming distance
Lower threshold = stricter matching (fewer false positives, more false negatives) Higher threshold = looser matching (more false positives, fewer false negatives)