Images Pixels Compare
Are These Two Images Identical? A Strict Pixel Check That Returns a Yes/No
- image1
- image2
- Result
Most "image comparison" in ComfyUI is a visual thing - rgthree's Image Comparer puts two pictures side by side so your eyes decide. Images Pixels Compare isn't that, and it's worth knowing the difference before you grab it. It doesn't show you anything. It asks one brutally literal question - "are these two images bit-for-bit identical?" - and answers with a single BOOLEAN that the rest of your graph can act on.
That's the whole job, and it's a useful one. Wire it after any node and you can branch on whether the output actually changed: "did this frame differ from the last one?", "is the denoise doing anything this run?", "did the seed actually give me a different result or did the workflow silently no-op?" Combined with a switch or an IF-style gate (the graph-as-a-program pattern from comfyui-node-plumbing), one boolean becomes real control flow - "if same, keep the cached image; if different, re-roll."
How it works
It takes two IMAGE tensors and compares every pixel value with torch.eq. If every channel of every pixel matches exactly, you get true; the moment a single value is off, you get false. That sounds obvious, but the strictness is the catch: ComfyUI images are float tensors, so this is exact-equality testing, not "close enough." A re-encode, a resize, an upscale pass, even a node that touches values in a way you can't see - all of it counts as "different."
There's one switch, if_same_output, that inverts the logic. Leave it true and you get true when identical; flip it false and the node returns true when the images differ. That's your "only proceed if something changed" mode, which is the case people actually reach for this node for.
The size gotcha
If the two images have different shapes (different resolution), the node can't compare pixel-to-pixel, and it returns false by default - treated as different. That's the sensible behavior, but it means this is not a "did the content change but the resolution didn't?" tool. Different resolutions always read as "different." If you want to compare across resolutions, resize both to a common size upstream first.
Install
Like the rest of the pack, ComfyUI Manager (search "ComfyUI-zyd232-Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/zyd232/ComfyUI-zyd232-Nodes.git
Restart ComfyUI and it's under the zyd232 Nodes category. No extra dependencies - this node is plain torch. It does need a recent ComfyUI, because the pack is written against the newer V3 backend node API (comfy_api.latest); an old install won't see it.
Bottom line
It's a thin utility, and it doesn't pretend otherwise. If you need a human to look at two images, use the comparer. If you need a graph to decide whether two images are identical, this is a one-node solution with no moving parts. Just remember the word "pixels" in the name is doing real work - this checks data, not meaning.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | First image to compare | |
| image2 | IMAGE | Second image to compare | |
| if_same_output | BOOLEAN | true | When true, outputs true if the images are identical; when false, inverts the logic |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Result | BOOLEAN | — |