ViewComfy - Compare
A Compare Node for When Your Workflow Has to Make a Decision
- a
- b
- BOOLEAN
ComfyUI is great at "do this, then that." It's mediocre at "do this if that." The Compare node from ViewComfy-Utils is the missing < / > / == in that sentence: it takes two values, runs a comparison, and spits out a plain BOOLEAN you can feed into a Conditional Select, a switch, or an error check. It's the kind of node that looks boring until you need to reject an image that's too small, and suddenly it's the whole workflow.
The inputs are refreshingly dumb in a good way: a and b, both * wildcards that accept almost any data type, and a comparison dropdown with eight options - a == b, a != b, a < b, a > b, a <= b, a >= b, a and b, a or b. The output is a single BOOLEAN. That's the whole surface, and that's the point: comparison is a solved problem, so the node stays out of your way.
The two behaviors that will bite you, straight from the source: tensor comparisons (images, video frames, latents) only support == and != - pick > on an image and it raises an error, because "bigger" doesn't mean anything for a tensor. The and and or operators require both inputs to be actual booleans, not truthy values, or the node refuses. On the bright side, when you do compare two tensors with ==, it compares element-wise and collapses to a single True/False via an all-values check, and if two images have different shapes it short-circuits to "not equal" instead of exploding.
Where it earns its keep: validation and branching. The pack's own example workflow is the canonical use: Load Image → Get Image Size → Compare a > b against a max-size primitive → feed the boolean into a Conditional Select to gate a Save Image, or into Show Error Message to reject an oversized upload. That pattern - check a property, branch or abort on the result - is exactly how you build a ComfyUI workflow that acts like an app instead of a one-shot pipeline. You can also use it to confirm two images are pixel-identical before spending a generation on a redundant path.
The main trap is the same one that catches everyone with logic nodes: it only fires when the value feeding it actually changes. ComfyUI caches hard, so if you want a comparison to re-evaluate every run, make sure an upstream node is forcing a re-run. And remember the booleans-only rule for and/or - feed it a 1/0 or a string and you'll get a hard error mid-graph.
Installation is shared with the whole pack: ComfyUI Manager → search "ViewComfy-Utils" → install, or clone by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/ViewComfy/ViewComfy-Utils
Restart ComfyUI after. No extra dependencies (just torch and Pillow, both already present), no model downloads, MIT licensed. It's a tiny node from a team that builds them for their own app platform, but it's genuinely useful in any workflow that needs to make a decision - and those are most workflows worth building.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| comparison | COMBO | a == b | 8 options: a == b, a != b, a < b, a > b, a <= b, a >= b, +2 |
| aopt | * | — | |
| bopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |