Nodes/ComfyUI-JakeUpgrade/Int Sub Operation JK๐Ÿ‰
ComfyUI Node

Int Sub Operation JK๐Ÿ‰

Subtraction, as a node, for when the math is part of the graph

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 147
Int Sub Operation JK๐Ÿ‰
    • INT
    โ—„a0โ–บ
    โ—„b0โ–บ

    Let's not pretend this is complicated: Int Sub Operation JK takes two integers and subtracts the second from the first. a - b, done. There is no hidden mode, no VAE, no model download. But if you've ever sat in ComfyUI wishing you could just subtract two frame counts inside the graph instead of doing it in your head and typing the answer, you know exactly why this exists.

    Why you'd reach for it

    ComfyUI is a graph, and every number you hard-type is a value that can't react to anything. The moment you build a group node or subgraph with an exposed integer input - "offset this cut by N frames," "total frames minus the warmup," "batch size minus one" - you want that arithmetic to happen at runtime, not be frozen into a literal. That's what this node is for. Jake's Wan and LTXV2 "Cuts" workflows lean on exactly this pattern: a computed frame count, minus overlap, fed into the sampler.

    It's also just cleaner than editing a KSampler's step math by hand in a text field. See an a - b, and you know what the graph means.

    Inputs and output

    • a - the first integer (the minuend, if you care about the proper term).
    • b - the second integer (the subtrahend).
    • Output - one INT, the result of a - b.

    That's the entire interface. The tooltips in the schema say exactly this, so there's no guessing about which side is which. Order matters - flip a and b and you get the negative.

    Where it lives

    It's part of the pack's Math/Int family, sitting alongside its siblings for add, multiply, divide, conditions, and boolean ops. If you find yourself needing more than a single subtraction - say, chaining several operations or computing something conditional - the pack's EvaluateInts node handles whole expressions. But for one clean operation, this is the node you drag out.

    Install and notes

    Same story as every node in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    pip install -r requirements.txt
    

    Then restart ComfyUI. No extra dependencies - this is pure Python arithmetic. One honest note: it does zero input validation, so feeding it wildly different-scale numbers won't warn you. That's on you, and honestly it's fine. The node's job is to be boring and predictable, and it is.

    Category๐Ÿ‰ JK/โœ–๏ธ Math/๐ŸŽก Int

    Inputs (2)

    NameTypeDefaultDescription
    aINT0First integer input (minuend)
    bINT0Second integer input (subtrahend)

    Outputs (1)

    NameTypeDescription
    INTINTโ€”