A command-line duplicate image finder written in Go. twix uses both cryptographic hashing and perceptual hashing to find exact duplicates and visually similar images in your directories.
go install github.com/PlotoZypresse/twix@latestMake sure your GOPATH is in your PATH environment variable to use the installed binary.
twix [mode] [distance] <folder-path>[mode]- Optional operation mode (default:-h)[distance]- Optional for setting distance threshold during pHash comparison (default:5)<folder-path>- Directory to scan for duplicate images
-h- Hash mode only (default): Uses SHA256 hashing to find exact duplicates-p- Perceptual hash mode only: Uses perceptual hashing to find visually similar images-hp- Both modes (currently displays "TODO" message)-distance=5- Distance threshold for pHash comparison
- Exact Duplicate Detection: Uses SHA256 hashing to find identical image files
- Similar Image Detection: Uses perceptual hashing to find visually similar images
- Multiple Operation Modes: Choose between hash comparison, perceptual comparison, or both
- Recursive Scanning: Automatically scans all subdirectories
- Multi-format Support: Works with JPEG and PNG images
- Performance Timing: Shows execution time for duplicate detection
twix employs two methods to detect duplicates:
- SHA256 Hashing: Creates unique fingerprints of image files to find exact duplicates - perfect for identical files
- Perceptual Hashing: Analyzes image content to find visually similar images, even if they're different files or have minor modifications
$ twix -h photos
Duplicate images found at: /photos/vacation/beach1.jpg and /photos/backup/beach-copy.jpg
Finding duplicates took: 1.234s
$ twix -p -distance=10 photos
Duplicate images found at: /photos/party/image.png and /photos/edited/party-edited.png
Finding duplicates took: 3.456s- JPEG (.jpg, .jpeg)
- PNG (.png)
If you prefer to build manually:
git clone https://github.com/PlotoZypresse/twix
cd twix
go build twix.goMIT License
- Hash Mode (-h): Fastest method, only finds 100% identical files
- Perceptual Hash Mode (-p): Slower but finds visually similar images with minor differences
- Combined Mode (-hp): Planned feature that will use both methods for comprehensive detection
Choose the mode based on your needs: use hash mode for quick exact duplicate finding, or perceptual mode when you suspect images have been resized, recompressed, or slightly modified.
If the perceptual mode returns a lot of duplicates try lowering the value. If no or few duplicates are returned try a higher value. The optimal value depends on the images.
The pHash comparison currently runs in
Always check images before deleting