Nodes/Jovimetrix/COMPARISON (JOV) πŸ•΅πŸ½
ComfyUI Node

COMPARISON (JOV) πŸ•΅πŸ½

If/then routing for data, without a logic pack

By AmoranoΒ·Created 3 years agoΒ·Updated 12 months agoΒ· 397
COMPARISON (JOV) πŸ•΅πŸ½
  • πŸ…°οΈ
  • πŸ…±οΈ
  • 😍
  • πŸ₯΅
  • ⚑
  • VAL
β—„πŸ•΅πŸ½β€β™€οΈEQUALβ–Ί
β—„πŸ™ƒfalseβ–Ί
β—„πŸ”³falseβ–Ί

COMPARISON (JOV) πŸ•΅πŸ½ is an if/then node for arbitrary data. It takes two values, compares them with any of 16 operators (EQUAL, NOT_EQUAL, LESS_THAN, GREATER_THAN, AND, OR, XOR, and the NAND/NOR/XNOR family, plus a few more), and routes a success value or a failure value based on the result. Two data ports in, a decision made, and - here's the good part - you get to define what "success" even passes along.

If you've been building branching ComfyUI workflows, you know the usual pattern is several nodes bolted together: a compare node, a switch node, a "pass this if true" node. This one collapses all of it into a single node, and it works on any type - numbers, vectors, strings, whatever. It's the Jovimetrix answer to "logic without a logic pack."

The inputs that matter

Six optional inputs, and the clever ones are the middle two:

  • πŸ…°οΈ - the master comparator (default 0).
  • πŸ…±οΈ - the secondary comparator (default 0). Compare these two.
  • 😍 - the data to pass on a successful comparison.
  • πŸ₯΅ - the data to pass on a failed comparison.
  • πŸ•΅πŸ½β€β™€οΈ - the comparison function (default EQUAL). The full 16 include the boolean logic ops AND/OR/XOR and their negations, which is where this turns into a general logic gate.
  • πŸ™ƒ - flip A and B (for when "greater than" and "less than" have you twisted around).
  • πŸ”³ - reverse the success and failure inputs, i.e. invert the whole decision.

The two outputs: ⚑ hands you whichever of the pass/fail inputs evaluated true, and VAL gives you the raw comparison result - handy when you want the boolean and the routed data.

How it works

It evaluates the chosen operator element-wise between A and B, and if the comparison holds for all elements it returns the success payload, otherwise the failure payload. That "all elements" detail matters: comparing two vectors succeeds only if every component passes, which is the correct behavior for chained conditions.

Installing it

Part of Jovimetrix:

  • ComfyUI Manager - search "Jovimetrix", install.
  • Manual - git clone https://github.com/Amorano/Jovimetrix.git into custom_nodes/, then pip install -r requirements.txt.

No models. Dependencies: numpy, OpenCV, Pillow, matplotlib, cozy_comfyui. Needs ComfyUI 0.1.3+.

Where it fits

Reach for this when a workflow branches: "if the seed is even, use prompt A, else prompt B" is a wired connection plus this node and a prompt switch. Or gate a whole stage - compare a counter against a threshold and pass a KSampler's settings on success and a "skip" value on failure. The trap is the same one as all if/then nodes: you'll wire it, it'll pass the wrong payload, and the fix is usually the πŸ™ƒ swap or the πŸ”³ invert rather than a rebuild. It's not the node people talk about, but it's the one that keeps procedural workflows from becoming a spiderweb of switches.

CategoryJOVIMETRIX πŸ”ΊπŸŸ©πŸ”΅/CALC

Inputs (7)

NameTypeDefaultDescription
πŸ…°οΈopt*0Master Comparator
πŸ…±οΈopt*0Secondary Comparator
😍opt*0pass this data on a successful condition
πŸ₯΅opt*0pass this data on a failure condition
πŸ•΅πŸ½β€β™€οΈoptCOMBOEQUALComparison function. Will pass the data in 😍 on successful comparison
πŸ™ƒoptBOOLEANfalseFlip Input A and Input B with each other
πŸ”³optBOOLEANfalsereverse the successful and failure inputs

Outputs (2)

NameTypeDescription
⚑*Outputs the input at πŸ…°οΈ or πŸ…±οΈ depending on which evaluated TRUE
VAL*The comparison result value