Nodes/Deforum Nodes/(deforum) INT Comparator
ComfyUI Node

(deforum) INT Comparator

Compare two integers and get a boolean your graph can act on

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) INT Comparator
    • BOOLEAN
    int_10
    int_20
    condition

    (deforum) INT Comparator is the pack's plain-vanilla integer comparison: two integers in, a true/false out, with a dropdown to pick <, <=, >, >=, or ==. It's the kind of node that barely needs an article - but it shows up in Deforum workflows more than you'd expect, because animations are full of frame counters, and "is the current frame past N yet?" is one of the most common questions a graph asks. Once you know it exists, you'll wire it into condition branches all over.

    How it works

    It takes int_1 and int_2 plus a condition, runs the comparison in Python, and returns the boolean. That's the entire mechanism - no math tricks, no schedule evaluation, no hidden state. The useful part is what you do with the boolean: wire it into a logic gate, a switch, or one of the pack's condition-driven paths to change behavior based on the frame count or any other integer you can route in. Since frame indices flow around the graph as integers, a comparator sitting on the frame counter is the standard way to build "do X after frame 50" logic.

    One quirk worth knowing: the node is flagged as an output node, meaning it appears in ComfyUI's list of output nodes and is executed even when its result isn't consumed downstream. For a comparison node that's harmless (and occasionally useful - it forces evaluation at a known point in the graph), but it means you might see it in the outputs panel even though you think of it as mid-graph plumbing.

    The inputs and outputs

    • int_1 - first integer, default 0 (range −999999 to 2³²).
    • int_2 - second integer, same range.
    • condition - <, <=, >, >=, or ==.
    • BOOLEAN - the comparison result.

    When you'd use it

    Three classic spots in a Deforum graph. Gating by frame number: frame_idx > 50 to flip an effect on after the intro. Guarding division or math that explodes at zero: int_2 != 0 before a divisor. And combining with the pack's Logical AND/OR nodes to build compound conditions - "beat detected AND past frame N," for instance. It's also a decent debugging tool: compare a value against a constant, wire the boolean to a text/status display, and you get a live "is this over the threshold" indicator while you tune. There's a float comparator sibling if your values aren't integers.

    Installing it

    Part of Deforum Nodes (XmYx). ComfyUI Manager → "Deforum Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/XmYx/deforum-comfy-nodes.git
    

    Restart and let first-boot install.py finish (librosa, opencv-contrib-python, moviepy, numpy<2.0.0, deforum-studio backend). Python 3.10 per the README.

    Where people get burned

    The honest gotcha: its integer-only nature. Route a float (like a denoise value) in here and it'll be coerced/truncated - use the float comparator for fractional comparisons. And because of that output-node flag, if you wire it into a loop or a heavy graph, it runs every execution whether you read its result or not; that's usually a non-issue (a comparison is microseconds), but it's why some people are surprised to see it "executing." Mostly, just remember which end of the comparison you're asking for - > vs >= off-by-ones on a frame counter are the classic silent bug.

    Categorydeforum/logic

    Inputs (3)

    NameTypeDefaultDescription
    int_1INT0-999999–4294967296
    int_2INT0-999999–4294967296
    conditionCOMBO5 options: <, <=, >, >=, ==

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN