ComfyUI Node

CRZ Compare

The 'if this, then that' decision node for people who don't want to write code

By CoreyCorza·Created 12 months ago·Updated 12 months ago· 42
CRZ Compare
  • a
  • b
  • BOOLEAN

CRZ Compare is the branch decision of the ComfyUI-CRZnodes dashboard pack: it takes two values, checks them against a comparison operator, and spits out a BOOLEAN that says which side won. Wire that boolean into a CRZ Switch (or Execute Switch) and you've built an actual conditional in your workflow - "if steps is high enough, use the detailer" - without writing a line of code.

This is the node that turns your dashboard from a row of pretty sliders into something that behaves. A slider feeds a, a fixed value feeds b, and downstream routing happens automatically. It's simple, but it's the kind of simple that unblocks a surprising number of workflows.

How it works

The comparison operator lives in a hidden widget, and you change it by double-clicking the node. The README's table is the ground truth:

| Symbol | Meaning | |--------|---------| | > | Is A greater than B? | | < | Is A less than B? | | >= | Is A greater than or equal to B? | | <= | Is A less than or equal to B? | | = | Does A equal B? |

The Python behind it has a nice touch: for the ordering operators it first tries to compare numerically (casting both sides to float), and if that fails it falls back to string comparison. So comparing two sliders works numerically, and comparing two text values still gives you a sensible answer. Equality (=) is a direct comparison of whatever came in - which is where you need to be careful, because 3 and "3" are not equal in Python.

The inputs and outputs

  • a and b (inputs) - both typed * (any), both default to 0. Feed them from sliders, ints, strings, whatever you're comparing.
  • BOOLEAN (output) - true when the comparison holds, false otherwise.

That's the entire schema: two inputs, one output, one hidden operator widget. The operator is the only thing you configure.

Where the gotchas live

Comparing different types is the main trap. = on a float slider at 5.0 and an integer 5 will usually compare equal, but comparing a string dropdown value to a number will not, and the numeric-comparison fallback only kicks in for >, <, >=, <= - not for =. If a comparison that "should" be true keeps returning false, check what type each side actually is.

Also note the node does its best, but it won't compare everything sensibly. Two images in, = out - the comparison will technically run and probably give you false. This is a scalar-comparison node; keep it for numbers and strings.

Installing it

Standard CRZ pack install: ComfyUI Manager → search ComfyUI-CRZnodes → install → restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/CoreyCorza/ComfyUI-CRZnodes.git

No requirements, no models. Everything in the pack comes together.

The pattern to steal

The genuinely useful combo: CRZ Float Slider → CRZ Compare (with >=) → CRZ Execute Switch, with two different processing paths hanging off the switch's true and false outputs. Now one slider decides which pipeline runs, and thanks to the Execute Switch's execution blocking, the branch you didn't pick never even runs. That's a dashboard you can hand to someone who's never opened ComfyUI.

CategoryCRZ

Inputs (2)

NameTypeDefaultDescription
a*0
b*0

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN