Image Hash
Fingerprint every image in the batch so you can spot duplicates and drift
- images
- STRING
If you're generating or processing images in bulk, you will eventually need to answer "is this the same as that?" - batch A got regenerated with a different seed, this folder has duplicates, that image on the input and the one in the output are the same or they aren't. Image Hash gives every image in a batch a short fingerprint, as a 64-bit number in JSON, so you can compare, dedupe, and track without eyeballing a thousand thumbnails.
It's the rare node that exists mostly for the outside of ComfyUI: you hash here, then do the bookkeeping in your own script or database.
How it works
This is a perceptual-ish hash, not a cryptographic one. The node shrinks each image to 8×8 pixels, converts to grayscale, and compares every pixel against the average brightness - each pixel becomes one bit, darker or lighter than the mean. Those 64 bits form the hash, reported as a signed 64-bit integer. It's the classic "average hash" scheme, hand-rolled in the pack (the imagehash library, the pack's only declared dependency, is used to format the result).
The point of a perceptual hash is that near-identical images produce near-identical hashes - so two images that differ only slightly (same image, different compression) get hashes that are close, and you can detect near-duplicates by comparing hash values rather than requiring an exact match. That's the whole game.
Inputs are images (the IMAGE batch) and names (the filenames, which become the JSON keys). Output is a single STRING of JSON, e.g. {"ref.png": -6012954223552610761, ...} - one entry per image, keyed by name.
Installing it
Same pack as the rest: comfyui_image_embeddings by baijunty. ComfyUI Manager → search "image_embeddings" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/baijunty/comfyui_image_embeddings
Note this is the one node whose dependency (imagehash) the pack actually declares, so Manager should pull it automatically.
Where people get burned
The values are signed - hashes can come back negative, which surprises people expecting an unsigned number. Fine for comparisons, just don't feed them into something that assumes non-negative IDs.
Second, keep the resolution in mind. An 8×8 average hash is compact and fast, but it's a blunt instrument. Two different-but-visually-similar images can collide, and a subtle edit (a caption added, a watermark) shifts it enough that exact-equality checks will say "different." It's great for "is this roughly the same image" and for change detection across runs; it's not a substitute for a real duplicate-file finder on a large library.
Also, the node has no custom IS_CHANGED, so ComfyUI applies its default input-based caching - hash a batch once and it won't redo the work unless the inputs actually change, which is what you want for a stable fingerprint. Wire the JSON string into a text preview or a save node and use the hashes wherever you keep your records.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| names | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |