pwlmc/imghash
pwlmc/imghash has 200 GitHub stars and 18 forks. Star changes are not measured yet. Last checked 2026-11-13 22:39 UTC. Last push 2026-11-11.
Progression mesurée des étoiles
- in 24h
- Historique en cours
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
À propos
Perceptual image hashing for Node.js
Outils de développementREADME.md
Originalimghash

Perceptual image hashing for Node.js
Installation
npm install imghash
Basic usage
import imghash from "imghash";
const hash1 = await imghash.hash("./path/to/file");
console.log(hash1); // "f884c4d8d1193c07"
// Use a 4-bit hash grid and return the result as binary
const hash2 = await imghash.hash("./path/to/file", 4, "binary");
console.log(hash2); // "1000100010000010"
Finding similar images
To measure similarity between images you can use Hamming distance or Levenshtein Distance.
The following example uses the latter one:
import imghash from "imghash";
import leven from "leven";
const hash1 = await imghash.hash("./img1");
const hash2 = await imghash.hash("./img2");
const distance = leven(hash1, hash2);
console.log(`Distance between images is: ${distance}`);
if (distance <= 12) {
console.log("Images are similar");
} else {
console.log("Images are NOT similar");
}
The threshold of 12 is a starting point, not a universal rule. Tune it for
your image set and the hash size you use.
API
hash(filepath, bits?, format?)
Calculates a perceptual hash for an image.
const hash = await imghash.hash("./image.png", 8, "hex");
| Parameter | Type | Default | Description |
|---|---|---|---|
filepath |
string | Buffer |
— | Image path or image data. |
bits |
number |
8 |
Hash grid size. Must be divisible by 4. |
format |
"hex" | "binary" |
"hex" |
Returned hash encoding. |
Returns: Promise<string>.
See the full API Reference.
Read more
Explorer des projets similaires
codecrafters-io/build-your-own-x
Maîtrisez la programmation en recréant de zéro vos technologies préférées.
562,340 étoilespublic-apis/public-apis
Une liste collective d'API gratuites
498,778 étoilesmorluto/rea
Rétro-ingénierie de n'importe quoi avec des agents, du comportement des applications jusqu'aux binaires natifs.
457,544 étoilesopenclaw/openclaw
L'IA qui fait vraiment les choses. Tout système d'exploitation, toute plateforme. À la manière du homard. 🦞
394,396 étoiles