* 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)
| 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 | /** |