PHPackages                             kodus/image-hash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. kodus/image-hash

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

kodus/image-hash
================

0.1.0(8y ago)152.7k7[1 PRs](https://github.com/kodus/image-hash/pulls)PHP

Since Jun 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/kodus/image-hash)[ Packagist](https://packagist.org/packages/kodus/image-hash)[ RSS](/packages/kodus-image-hash/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

kodus/image-hash
================

[](#kodusimage-hash)

This library implements the aHash, dHash and pHash image-hashing algorithms as described in [this article](http://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html).

It's based on [this implementation](http://jax-work-archive.blogspot.dk/2013/05/php-ahash-phash-dhash.html)but with a loader-abstraction for GD and Imagick support, added tests, and a benchmark.

Usage
-----

[](#usage)

To compare two images:

```
use Kodus\ImageHash\ImageHasher;

$hasher = new ImageHasher();

$a_hash = $hasher->pHash("path/to/image-a.jpg");
$b_hash = $hasher->pHash("path/to/image-b.jpg");

if ($hasher->getDistance($a_hash, $b_hash)
