ComfyUI Node

Less than

The quiet workhorse of aspect-ratio checks

By marco-zanella·Created about a year ago·Updated about a year ago· 0
Less than
  • first
  • second
  • result

Less than is the unglamorous workhorse of conditional ComfyUI workflows. While "Greater than" gets all the glory in aspect-ratio checks, "Less than" is the one handling the other direction - and in the pack's own demo workflow, it's a Less than check that decides whether an image is portrait versus landscape. Two numbers in, a boolean out, and a whole branch of your graph hinges on it.

It's part of marco-zanella's ComfyUI-BooleanExpression pack, a pure-Python logic collection with no dependencies. Like its siblings, it's dead simple on purpose: first < second, evaluated in Python, no surprises.

The inputs

Two required inputs, both INT or FLOAT:

  • first - the first number (default 0)
  • second - the second number (default 0)

Output is result, a BOOLEAN: first < second. That's it. The node is a single Python comparison; there's genuinely nothing hidden.

The classic wiring: take an image's height and width (or the config for a target resolution), feed them to Less than, and the boolean drives a Conditional Branch. "Height less than width → it's landscape → landscape prompt." The pack's conditional-format-prompt example does exactly this alongside its Equal to check. The same pattern covers denoise values ("if steps are under 20, use a higher denoise"), CFG ranges, batch sizes - any time the question is "is this small enough."

Installing it

No models, no Python dependencies (the pack's requirements.txt is empty), nothing to download but the folder. Install via ComfyUI Manager by searching ComfyUI-BooleanExpression, or:

cd ComfyUI/custom_nodes
git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git

Restart ComfyUI and it shows up under Boolean Expressions → Arithmetic Comparisons.

Gotchas

  • Strict means strict. first < second is false when the two are equal. If your rule is really "at most this" or "up to this," you want the inclusive variant, Less than or equal to. Off-by-one at a boundary is the classic silent bug here.
  • Wire real numbers. The inputs accept INT or FLOAT cleanly, including int-vs-float mixing, so no conversion fuss - but do feed actual numeric outputs, not strings. A string into this node is a type mismatch ComfyUI may or may not forgive.
  • Both branches downstream still run. A comparison node only picks a value; ComfyUI computes both input chains of any Conditional Branch it feeds. Trivial cost for numbers, worth remembering for the general pattern.
  • Node not in the menu after install? Restart ComfyUI and double-check the clone landed in custom_nodes. The pack is small and installs cleanly, so that's nearly always the fix.

If you're going to flip between <, , =, and friends on the same two numbers, Binary Comparison in the same pack collapses all six operators into one dropdown. But when the question is a stable "is it less," this dedicated node is the clearer one to leave sitting in a shared workflow.

CategoryBoolean Expressions/Arithmetic Comparisons

Inputs (2)

NameTypeDefaultDescription
firstINT,FLOAT0The first number.
secondINT,FLOAT0The second number.

Outputs (1)

NameTypeDescription
resultBOOLEAN