Compare (PixNodes)
The if-statement your ComfyUI graph was missing
- a
- b
- boolean
Somewhere in every big workflow there's a moment where you want to say "if the seed is bigger than 500, do X, otherwise do Y." ComfyUI core gives you the plumbing but not the comparison - Pix_Compare is the comparison. Two values in, a boolean out, and a dropdown with all six operators. It's the least glamorous node in the PixNodes pack and one of the ones you'll actually reach for.
The inputs are a and b, both wildcard * slots, plus a comparison menu with a == b, a != b, a < b, a > b, a <= b, a >= b. Wire a couple of INTs, FLOATs, or strings in and pick the operator. One BOOLEAN comes out, named boolean, ready to drive an If-Else dispatcher, a switch, or anything else that gates on a condition.
The wildcard typing is worth understanding because it's doing real work. a and b are defined with an AlwaysEqualProxy that returns True for every __eq__, which is the trick that lets any data type plug in without ComfyUI rejecting the connection at the canvas level. The actual comparison still happens in Python with normal semantics, so 5 < 3 is False and "hello" == "hello" is True - no surprise coercions. For numbers it's exact, and that's the thing to keep in mind: a == b on two floats that came from different branches can be False for pure floating-point reasons (0.1 + 0.2 vs 0.3, the old classic). If you're comparing computed floats, prefer a tolerance-based check or round before comparing.
Where does this actually live in a workflow? The canonical pairing is with Pix_ForLoopStart/Pix_ForLoopEnd - the loop nodes themselves build comparisons through this node internally when they decide whether to keep iterating, so if you see a Pix_Compare appear in a loop you didn't build, that's why. Outside loops, it gates batch processing: compare a counter against a target, compare an image count against a threshold, then let the result pick which branch of an If-Else Dispatcher runs. It's the raw material for the graph-level conditionals that the plumbing layer (covered well in the KB's node-plumbing essay) is all about.
Install is the standard PixNodes one - ComfyUI Manager, search PixNodes, restart - or:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
cd Comfyui-PixNodes
pip install -r requirements.txt
then restart. Deps are trivial (openai, Requests). No models, no VRAM, no catch.
One trap worth naming: there's no IS_CHANGED override, so ComfyUI caches the result as long as the inputs don't change. That's what you want 99% of the time - a comparison whose inputs are constant will correctly run once. Just don't expect this node to fire on its own every run; if you need that, the input feeding it has to change. It won't.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | * | 0 | — |
| b | * | 0 | — |
| comparison | COMBO | a == b | 6 options: a == b, a != b, a < b, a > b, a <= b, a >= b |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| boolean | BOOLEAN | — |