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

Function distance

plugins/plugin-hash/src/index.ts:103–109  ·  view source on GitHub ↗
(img1: I, img2: I)

Source from the content-addressed store, hash-verified

101 * ```
102 */
103export function distance<I extends JimpClass>(img1: I, img2: I) {
104 const phash = new ImagePHash();
105 const hash1 = phash.getHash(img1);
106 const hash2 = phash.getHash(img2);
107
108 return phash.distance(hash1, hash2);
109}
110
111/**
112 * Calculates the hamming distance of two images based on their perceptual hash

Callers 2

exif.node.test.tsFile · 0.85
index.test.tsFile · 0.85

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…