Nodes/FlowNodes/❓ Compare (Int)
ComfyUI Node

❓ Compare (Int)

Turn two numbers into a yes/no

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 13
❓ Compare (Int)
    • Result
    β—„Actionβ–Ύβ–Ί
    β—„Aβ€”β–Ί
    β—„Bβ€”β–Ί

    ComfyUI is bad at "if this, then that." The graph model has no natural conditional, so people fake it - and the cheapest fake is a comparison node that outputs a boolean you can feed into a switch or a mask for conditional behavior. Int Compare is exactly that: two integers in, one true/false out, with six operators to choose from.

    The realistic use: workflow gating. "If my seed is greater than 1000, take path A, else path B." "If the batch count is at least 4, enable the upscale pass." Anywhere a number should drive a decision, Int Compare turns it into a boolean that another node can act on. It's the primitive your workflow needs once you start wanting branching behavior.

    How it works

    It compares a against b using the operator you pick, and returns the result as a boolean. The operators are the standard six:

    • GT - a > b
    • LT - a < b
    • GTE - a >= b
    • LTE - a <= b
    • EQUAL - a == b
    • NOTEQUAL - a != b

    The output is Result (BOOLEAN). Wire it into a switch node, a conditional mask, or anything that accepts a boolean to make your graph branch.

    Installing it

    Int Compare ships in ComfyUI-TinyBee, a small MIT-licensed utility pack with no model downloads. Via Manager:

    1. ComfyUI Manager β†’ Custom Nodes Manager.
    2. Search "ComfyUI-TinyBee" and install.
    3. Restart ComfyUI.

    Or clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    

    Restart and it's under 🐝TinyBee/Casting. No special dependencies - the pack's jsonata requirement is only for its JSON Parser node.

    Gotchas

    One comparison per node, full stop. If you need "a > 5 AND b < 10" you'll have to chain two Int Compare nodes and combine the booleans yourself - there's no built-in AND/OR here. Also remember this only compares integers; if your numbers are floats, use the pack's Float Compare, and if they're text, String Compare. And a small trap: EQUAL on two integers is exact, so if a downstream float conversion rounds a value into the comparison, results can surprise you - keep the whole comparison in integers.

    CategoryπŸ”‚ FlowNodes/comparisons

    Inputs (3)

    NameTypeDefaultDescription
    ActionCOMBO6 options: ==, !=, <, >, <=, >=
    AINTβ€”
    BINTβ€”

    Outputs (1)

    NameTypeDescription
    ResultBOOLEANβ€”