Image to MD5
Image to MD5 — the name lies, and that's the useful part
- image
- md5_hash
The most important thing to know first
ImgToMD5 does not hash your image file. I'll say that again because the name begs to differ: it hashes the image tensor that's flowing through your graph at that exact moment. The source does image.numpy().tobytes() and feeds those bytes to hashlib.md5 - that's the raw in-memory float data, not the PNG or JPEG you'd find on disk. The hash you get back will not match the file's checksum, and no tool that dedupes your outputs folder by file hash will agree with it.
That sounds like a bug. It's actually the point, once you know what it's for.
What it's actually good for
Because it fingerprints the exact pixel values at a specific point in the pipeline, it's an equality tester for images. Three genuinely useful jobs:
- Non-determinism hunting. Run the same workflow with the same seed, hash the output, run again, hash again. Differing hashes mean something upstream is nondeterministic - a node, a sampler, a GPU quirk. Same hashes means you can trust your seeds.
- Is a node doing anything? Bypass a processing node, compare the hash before and after. If it's identical, that node is a no-op on this input and you can cut it out of the graph.
- Cache keys and dedup in your own automation. If a workflow's output is byte-identical to one you already ran, the hash tells you so without eyeballing two images.
Inputs and outputs
- image (IMAGE) - a wired connection, not a typed path. Any image-producing node works: Load Image, VAE Decode, KSampler's output, whatever. If there's no wire, there's nothing to hash.
- case (enum, default
lower) -lowerorupper, cosmetic. - md5_hash (STRING, output) - the 32-character hex digest.
On failure it returns a string like error: <message> rather than raising - same pattern as the pack's other nodes, easy to miss if you're not watching.
The gotchas
- Any change upstream changes the hash. Resize the image, change the batch size, switch a sampler, and the hash changes - even if it looks like the same picture to you. That's by design, but it means hashes only compare meaningfully between runs where the whole upstream graph is identical.
- Same pixels, different file, different hash. The float tensor and the bytes a PNG encoder writes are different representations. Don't use this node to verify a download or match CivitAI's published checksums - that's what FileToMD5 (same pack, hashes a path on disk) is for.
Installing it
The pack is ComfyUI_md5. In ComfyUI Manager, search ComfyUI_md5 → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/duldduld/ComfyUI_md5
# restart ComfyUI
Pure Python standard library, nothing to pip install, no models. Find it under utils/hash → Image to MD5.
Bottom line
Don't reach for it when you need a file checksum. Reach for it when you need to prove two images in your graph are - or aren't - the same exact data. That's a niche job, but it's a real one, and it's the only honest way to answer "did my seed actually hold" without a pixel-by-pixel diff.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| case | COMBO | lower | 2 options: lower, upper |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| md5_hash | STRING | — |