#perceptual #deduplication #hash #wavelet #computer-vision #imagehash

imgdd

Performance-first perceptual hashing library; perfect for handling large datasets. Designed to quickly process nested folder structures, commonly found in image datasets

4 releases

new 0.1.3 Feb 7, 2025
0.1.2 Feb 5, 2025
0.1.1 Jan 30, 2025
0.1.0 Jan 30, 2025

#337 in Algorithms

Download history 198/week @ 2025-01-26 310/week @ 2025-02-02

508 downloads per month

GPL-3.0-or-later

35KB
308 lines

Documentation Status codecov DeepSource

imgdd: Image DeDuplication

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.

Features

  • Multiple Hashing Algorithms: Supports aHash, dHash, mHash, pHash, wHash.
  • Multiple Filter Types: Supports Nearest, Triangle, CatmullRom, Gaussian, Lanczos3.
  • Identify Duplicates: Quickly identify duplicate hash pairs.
  • Simplicity: Simple interface, robust performance.

Why imgdd?

imgdd has been inspired by 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.


Quick Start

Installation

pip install imgdd

Usage Examples

Hash Images

use imgdd::*;
use std::path::PathBuf;

let result = hash(
    PathBuf::from("path/to/images"),
    Some("Triangle"), // Optional: default = "Triangle"
    Some("dHash"),   // Optional: default = "dHash"
    Some(false),     // Optional: default = false
);
println!("{:#?}", result);

Find Duplicates

use imgdd::*;
use std::path::PathBuf;

let result = dupes(
    PathBuf::from("path/to/images"),
    Some("Triangle"), // Optional: default = "Triangle"
    Some("dHash"),   // Optional: default = "dHash"
    false,
);
println!("{:#?}", result);
```(duplicates)

Supported Algorithms

  • aHash: Average Hash
  • mHash: Median Hash
  • dHash: Difference Hash
  • pHash: Perceptual Hash
  • wHash: Wavelet Hash

Supported Filters

  • Nearest, Triangle, CatmullRom, Gaussian, Lanczos3

Contributing

Contributions are always welcome! 🚀

Found a bug or have a question? Open a GitHub issue. Pull requests for new features or fixes are encouraged!

Similar projects

Dependencies

~6–15MB
~198K SLoC