#hash #perceptual #image #faster #methods #dhash #perceptual-hashing

fast-dhash

A fast rust implementation of the perceptual hash dhash

1 unstable release

0.1.0 Mar 29, 2023

#13 in #perceptual

24 downloads per month

MIT license

14KB
155 lines

fast dhash

A fast rust implementation of the perceptual hash "dhash".

The main difference with other rust implementations, and the reason it is called "fast", is that it doesn't use grayscale and resize_exact image methods, therefore running about ~50% faster

basic usage

use fast_dhash::Dhash;

use image;
use std::path::Path;

fn main() {
    let path = Path::new("../image.jpg");
    let image = image::open(path);

    if let Ok(image) = image {
        let hash = Dhash::new(&image);
        println!("hash: {}", hash);
        // hash: d6a288ac6d5cce14
    }
}

lib.rs:

fast dhash

A fast rust implementation of the perceptual hash "dhash".

The main difference with other rust implementations, and the reason it is called "fast", is that it doesn't use grayscale and resize_exact image methods, therefore running about ~50% faster

basic usage

use fast_dhash::Dhash;

use image;
use std::path::Path;

fn main() {
    let path = Path::new("../image.jpg");
    let image = image::open(path);

    if let Ok(image) = image {
        let hash = Dhash::new(&image);
        println!("hash: {}", hash);
        // hash: d6a288ac6d5cce14
    }
}

Dependencies

~14MB
~83K SLoC