Calculate image hash
- NodeJS
- Python
pip install -r requirements.txt
npm install
npm run dev
Calculates the wavelet hashing for a given image url. Url should be passed in a JSON object in the body of a request.
Image hashing is based on ImageHash Python library.
E.g.:
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://some-image-url"}' localhost:5000/hash
Response
{
binaryHash: "<some-64-binary-hash-value>",
pHash: "<some-64-perceptual-hash-value>",
wHash: "<some-64-wavelength-hash-value>",
}
Calculates the distance between passed hashes.
Body message should be in following structure
{
"origin": "<64-chars-string-hash>",
"candidates": ["some-hash", "another-hash"]
}
The method returns the array of distances between origin hash and candidates. The length of the response equals to the amount of candidates.
E.g.
curl -X POST -H "Content-Type: application/json" -d '{"origin":"fffffff9fc11fffee7ffeff0fffd1ff80fe006f0002000010003000300038007", "candidates": ["fffffff9fc11fffee7ffeff0fffd1ff80fe006f0002000010003000300038009"]}' localhost:5000/diff
[3]