commonsmachinery / blockhash-js

Image perceptual hash calculation in javascript
http://blockhash.io/
MIT License
172 stars 49 forks source link

Implement support for GIF #8

Open jonasob opened 9 years ago

jonasob commented 9 years ago

It would be useful to be able to support GIF. This is some JS code for a GIF decoder that may be useful in this: https://github.com/deanm/omggif

qgustavor commented 9 years ago

This, as other issues, can be resolved simply by using in browser decoding tool, i.e. canvas. The getImageData() API is almost the same as the libraries used in this one and it supports any type of image that the browser understands (like .gif, .webp, .bmp).

In fact I'm just using blockhashData instead of blockhash as I'm getting images via drag and drop and decoding with canvas ( not via XHR ). I don't know if there is a good server side alternative like canvas is, but as seems this library is focused on browsers ( as server side doesn't support XMLHttpRequest ) that is a good improvement using canvas.