phash-image
pHash for images in node.js.
Phash is a library that will create a "perceptual hash" of media files, so similar files will return similar hashes. Typically to compare hashes, a simple Hamming distance between the two hashes is a good indicator of how similar two media files are.
Installation
phash-image depends on CImg, pHash, ImageMagicK.
On Ubuntu:
sudo apt-get install cimg-dev libphash0-dev libmagickcore-devOn OSX:
brew install phash imagemagickThen, install using npm:
$ npm install phash-imageAPI
phash(filename, [returnBigInt], [callback]).then( hash => )
var phash = ;// with a callback;// as a promise;If you want to return a ulong64 as a string to store in a database,
set true as the second parameter.
phash.mh(filename, [callback]).then( hash => )
Phash's MH 72-byte length hash. This is slower, but should be more accurate.
phashComparing phashes
To compare phashes, use hamming-distance.