Skip to content
No description, website, or topics provided.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

JavaScript Image Similarity Comparison

Build Status

This is a first draft of a basic image comparison algorithm using average hashes. The algorithm used is the one described here:

The library is only supposed to work in latest WebKit. Supports for Canvas and Array.forEach is required.


var img1 = $('#image1'),
    img2 = $('#imge2');

// returns a difference rate (from 0 to 1), img2);

// returns true or false (same as compare with a default threshold)
simi.same(img1, img2);

// returns a hash of the image
// simi.hash could be invoked to cache the hash
var hash = simi.hash(img1);, img2); // only img2 will be hashed


The library doesn't have any external dependencies, but you need bower, jquery, underscore, mocha and chai to run tests

How to run tests

Tests are now run automatically using Travis CI. If you need to run tests manually you just need to use Grunt and run the default task.

If you want to run tests manually from a browser you can follow this process:

# run tests inside the browser
cd ..
python -m SimpleHTTPServer
open http://localhost:8000/spec/index.html

Always remember to download spec depdencies using bower before doing anything:

# install tests dependencies using bower
cd spec
bower install
You can’t perform that action at this time.