Popularity
4.8
Growing
Activity
0.0
Stable
295
6
58

Programming language: Rust
License: Apache License 2.0
Tags: Perceptual     Hash     Difference     Image    

img-hash alternatives and similar packages

Based on the "Image processing" category.
Alternatively, view img-hash alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of img-hash or a related project?

Add another 'Image processing' Package

README

img_hash Build Status Crates.io shield

Now builds on stable Rust! (But needs nightly to bench.)

A library for getting perceptual hash values of images.

Thanks to Dr. Neal Krawetz for the outlines of the Mean (aHash), Gradient (dHash), and DCT (pHash) perceptual hash algorithms:
http://www.hackerfactor.com/blog/?/archives/432-Looks-Like-It.html (Accessed August 2014)

Also provides an implementation of the Blockhash.io algorithm.

This crate can operate directly on buffers from the PistonDevelopers/image crate.

Usage

Documentation

Add img_hash to your Cargo.toml:

[dependencies.img_hash]
version = "3.0"

Example program:

 extern crate image;
 extern crate img_hash;

 use img_hash::{HasherConfig, HashAlg};

 fn main() {
     let image1 = image::open("image1.png").unwrap();
     let image2 = image::open("image2.png").unwrap();

     let hasher = HasherConfig::new().to_hasher();

     let hash1 = hasher.hash_image(&image1);
     let hash2 = hasher.hash_image(&image2);

     println!("Image1 hash: {}", hash1.to_base64());
     println!("Image2 hash: {}", hash2.to_base64());

     println!("Hamming Distance: {}", hash1.dist(&hash2));
 }

Benchmarking

In order to build and test on Rust stable, the benchmarks have to be placed behind a feature gate. If you have Rust nightly installed and want to run benchmarks, use the following command:

cargo bench --features bench

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


*Note that all licence references and agreements mentioned in the img-hash README section above are relevant to that project's source code only.