|
| 1 | +[](https://codecov.io/gh/aastopher/imgdd) |
| 2 | +[](https://aastopher.github.io/imgdd/) |
| 3 | +[](https://app.deepsource.com/gh/aastopher/imgdd/) |
| 4 | + |
| 5 | +# imgdd: Image DeDuplication |
| 6 | + |
| 7 | +`imgdd` is a performance-first perceptual hashing library that combines Rust's speed with Python's accessibility, making it perfect for handling large datasets. Designed to quickly process nested folder structures, commonly found in image datasets. |
| 8 | + |
| 9 | +## Features |
| 10 | +- **Multiple Hashing Algorithms**: Supports `aHash`, `dHash`, `mHash`, `pHash`, `wHash`. |
| 11 | +- **Multiple Filter Types**: Supports `Nearest`, `Triangle`, `CatmullRom`, `Gaussian`, `Lanczos3`. |
| 12 | +- **Identify Duplicates**: Quickly identify duplicate hash pairs. |
| 13 | +- **Simplicity**: Simple interface, robust performance. |
| 14 | + |
| 15 | +## Why imgdd? |
| 16 | + |
| 17 | +`imgdd` has been inspired by [imagehash](https://github.com/JohannesBuchner/imagehash) and aims to be a lightning-fast replacement with additional features. To ensure enhanced performance, `imgdd` has been benchmarked against `imagehash`. In Python, **imgdd consistently outperforms imagehash by ~60%–95%**, demonstrating a significant reduction in hashing time per image. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +# Quick Start |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +```bash |
| 26 | +pip install imgdd |
| 27 | +``` |
| 28 | + |
| 29 | +## Usage Examples |
| 30 | + |
| 31 | +### Hash Images |
| 32 | + |
| 33 | +```rust |
| 34 | +use imgdd::*; |
| 35 | +use std::path::PathBuf; |
| 36 | + |
| 37 | +let result = hash( |
| 38 | + PathBuf::from("path/to/images"), |
| 39 | + Some("Triangle"), // Optional: default = "Triangle" |
| 40 | + Some("dHash"), // Optional: default = "dHash" |
| 41 | + Some(false), // Optional: default = false |
| 42 | +); |
| 43 | +println!("{:#?}", result); |
| 44 | +``` |
| 45 | + |
| 46 | +### Find Duplicates |
| 47 | + |
| 48 | +```rust |
| 49 | +use imgdd::*; |
| 50 | +use std::path::PathBuf; |
| 51 | + |
| 52 | +let result = dupes( |
| 53 | + PathBuf::from("path/to/images"), |
| 54 | + Some("Triangle"), // Optional: default = "Triangle" |
| 55 | + Some("dHash"), // Optional: default = "dHash" |
| 56 | + false, |
| 57 | +); |
| 58 | +println!("{:#?}", result); |
| 59 | +```(duplicates) |
| 60 | +``` |
| 61 | + |
| 62 | +## Supported Algorithms |
| 63 | +- **aHash**: Average Hash |
| 64 | +- **mHash**: Median Hash |
| 65 | +- **dHash**: Difference Hash |
| 66 | +- **pHash**: Perceptual Hash |
| 67 | +- **wHash**: Wavelet Hash |
| 68 | + |
| 69 | +## Supported Filters |
| 70 | +- `Nearest`, `Triangle`, `CatmullRom`, `Gaussian`, `Lanczos3` |
| 71 | + |
| 72 | +## Contributing |
| 73 | +Contributions are always welcome! 🚀 |
| 74 | + |
| 75 | +Found a bug or have a question? Open a GitHub issue. Pull requests for new features or fixes are encouraged! |
| 76 | + |
| 77 | +## Similar projects |
| 78 | +- https://github.com/JohannesBuchner/imagehash |
| 79 | +- https://github.com/commonsmachinery/blockhash-python |
| 80 | +- https://github.com/acoomans/instagram-filters |
| 81 | +- https://pippy360.github.io/transformationInvariantImageSearch/ |
| 82 | +- https://www.phash.org/ |
| 83 | +- https://pypi.org/project/dhash/ |
| 84 | +- https://github.com/thorn-oss/perception (based on imagehash code, depends on opencv) |
| 85 | +- https://docs.opencv.org/3.4/d4/d93/group__img__hash.html |
0 commit comments