M Int Sub (a - b)
M Int Sub in practice
- a_minus_b
Addition gets the attention, but half the useful arithmetic in a ComfyUI graph is subtraction: stepping a seed back, shrinking a dimension, computing a difference. M Int Sub is the mirror image of the pack's add node - a - b, one integer out, nothing clever going on.
Two INT inputs, a and b (default 0, signed 32-bit range), and one output named a_minus_b. The implementation is literally Python's a - b. Boring in the best way - there's no mode switch, no rounding surprise, no hidden behavior to learn before you can trust it.
The genuinely useful patterns:
- Backwards seed stepping.
a_minus_bwired into a converted KSampler seed input gives you deterministic "previous seed" style variation - the exact inverse of the "+1 per run" trick. - Residual math. In upscaling or latent workflows, "target minus current" (target size minus current width, budget minus steps used) is a recurring shape, and having it as a visible node keeps the intent in the graph instead of buried in a value you hand-computed.
- Offsets that need to stay coupled. When two values must keep a fixed difference and you retune one, feeding both from a single subtraction keeps them locked together.
Because the sockets accept wires or typed values and compose with the pack's other math nodes, M Int Sub is one of those nodes you'll drag in without thinking once you've got the pack installed. It handles negatives correctly (subtracting a negative adds), so the "reverse the sign" trick you'd expect works.
It ships in ComfyUiNodes (repo Madlumi/ComfyUiNodes, author "Madanie"), a lightweight grab-bag of integer math, string helpers, and workflow-glue nodes. Install via ComfyUI Manager - search "ComfyUiNodes" - or:
cd ComfyUI/custom_nodes
git clone https://github.com/Madlumi/ComfyUiNodes
Then restart ComfyUI. No pip requirements or model downloads - pure Python on ComfyUI's own deps. Find it under Add Node → mnodes → int.
That's the whole review: if you already run the pack, this is a free primitive; if you don't, subtraction-as-a-node is a small reason to grab it alongside the rest. Just remember the 32-bit input clamp and you'll never have a surprise here.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0-2147483648–2147483647 | — |
| b | INT | 0-2147483648–2147483647 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| a_minus_b | INT | — |