A pHash is a "perceptual hash" of a multimedia file derived from various features from its content. This can be useful to compare similar files, create database indices and so on.
Note: Currently supports only images - no video or audio.
$ npm install phash
varpHash=require("phash");pHash.imageHash("file.jpg",function(err,hash){if(err){console.error(err);}console.log("pHash: "+hash);});varhashA=pHash.imageHashSync("a.jpg");varhashB=pHash.imageHashSync("b.png");varhammingAB=pHash.hammingDistance(hashA,hashB);console.log("Hamming Distance A -> B: "+hammingAB);Computes a pHash asynchronously.
imageHash(filename,function(err,hash));Computes a pHash.
varhash=imageHashSync(filename);Computes the Hamming distance between the two pHashes.
hammingDistance(hashA, hashB);
Licensed under the incredibly permissiveMIT License. Copyright © 2013 Aaron Marasco.
Dependencies may be licensed diffrently.
NOTE: The Node bindings for pHash provided are are MIT licensed and may be used and modified freely. You must also comply with the terms of whichever pHash License you are using.

