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.
sudo apt-get install cimg-dev libphash0-dev libmagickcore-dev
brew install phash imagemagick
Then, install using npm:
$ npm install phash-image
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,
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.
To compare phashes, use hamming-distance.