MCPcopy
hub / github.com/jimp-dev/jimp / distanceFromHash

Function distanceFromHash

plugins/plugin-hash/src/index.ts:80–85  ·  view source on GitHub ↗

* Calculates the hamming distance of the current image and a hash based on their perceptual hash * @param compareHash hash to compare to * @returns a number ranging from 0 to 1, 0 means they are believed to be identical * @example * ```ts * import { Jimp } from "jimp"; * * cons

(image: I, compareHash: string)

Source from the content-addressed store, hash-verified

78 * ```
79 */
80 distanceFromHash<I extends JimpClass>(image: I, compareHash: string) {
81 const pHash = new ImagePHash();
82 const currentHash = pHash.getHash(image);
83
84 return pHash.distance(currentHash, compareHash);
85 },
86};
87
88/**

Callers

nothing calls this directly

Calls 2

getHashMethod · 0.95
distanceMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…