Image similarity in JavaScript

I wrote a little piece of JavaScript to calculate if two images are similar.

The algorithm is fairly simple, but it seems to do a decent work.
It correctly matches images with different scaling, different saturation, some blurring, different compression rates.

More details about the library can be found on its Github page:
https://github.com/bitlyfied/js-image-similarity

Here you can find an in depth discussion of the algorithm:
http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html

Advertisement

2 thoughts on “Image similarity in JavaScript

  1. rahul kotte

    Hey Congratz man, Just found out that you are joining AAMedia, I am very happy for you. When are you starting.

    By the way a cool way to test screenshots. So how do we use this piece of JS.

    cheers, Rahul

    Reply
  2. bitlyfied Post author

    hey man! thanks, I’m starting on Monday.

    actually, it’s not a good fit for testing screenshots regression.
    this is a very fast, but fuzzy algorithm. it helps finding similar images quickly, something like Google Search by Image http://www.google.com/insidesearch/features/images/searchbyimage.html

    for calculating an exact diff of two images there’s already a good library called js-imagediff: https://github.com/HumbleSoftware/js-imagediff/

    guess what: someone already built with it a framework to test regression’s on screenshots:
    https://github.com/cburgmer/csscritic

    see you soon!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s