subtract
Subtraction, the boring node that keeps your math integer-typed
- INT
Offsets, margins, countdowns, "how many frames are left" - subtraction is everywhere, and subtract from the Basic data handling pack is the version that stays integer-typed end to end. It's the least interesting node in the whole INT family and that's exactly why you'll reach for it: no float creep, no surprises, just int1 - int2 with the type contract you asked for.
What it does
int1 - int2, exactly as written. 10 - 3 is 7. The order matters, of course - this is the node's entire job - and both inputs default to 0, so the untouched node outputs 0. It's the mirror image of the pack's IntAdd, and the two are meant to be used together whenever you're adjusting a value by a live amount rather than a fixed number.
Inputs and outputs
int1- INT, default0. The starting value.int2- INT, default0. What you're taking away.- Output
INT- the difference.
Install
From the Basic data handling pack. ComfyUI Manager → search "Basic data handling" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart ComfyUI. Zero dependencies, no model downloads.
Why you'd bother when math nodes exist
The honest pitch: because generic math nodes give you floats, and floats come with rounding, precision noise, and the occasional 7.000000000000001 that makes a comparison node fail for no visible reason. When your pipeline is resolution integers, batch sizes, and step counts, an INT-only - keeps the whole chain exact. That's the quiet value of the pack's arithmetic nodes - they're not smarter than a math node, they're just reliably, boringly typed.
Where people slip: subtracting in the wrong order when building a "remaining = total − used" pattern, or feeding it a float because the value arrived from a text parse. Cast text with create INT first, and this node will behave exactly like the arithmetic you learned in grade school.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| int1 | INT | 0 | — |
| int2 | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |