Integer Subtraction
Subtract, and pass the amount through
- Result (INT)
- Result (STRING)
- subtracted_value
Subtract one integer from another. Like its multiply and add siblings, it's a small arithmetic helper for when a workflow needs a computed number rather than a typed constant. What makes this one slightly more than a calculator is a third output: it also passes the subtracted amount straight through, which turns out to be exactly what you need for one specific, fiddly job in the pack.
That job is positioning masks. The author calls it out directly: this node's main use is with Create Mask With Canvas. When you're placing a mask by coordinates and you want it anchored to the bottom of a canvas rather than the top, you compute Y = canvas_height − mask_height, then you need that same mask height fed to the mask's Height input. Subtraction gives you both from one node - the computed Y on one output, the height it subtracted on another - so the two stay linked when you change either.
How it works
It takes int_value and subtracted_value, computes int_value − subtracted_value, and gives you three outputs: the result as an INT, the result as a STRING (for display), and the subtracted_value passed through unchanged. That pass-through is the design flourish - it lets one node both do the math and forward the operand that a downstream node also needs.
The inputs that matter
- int_value - the number you're subtracting from.
- subtracted_value - the amount to subtract, which is also echoed on an output.
Outputs: Result (INT), Result (STRING), and subtracted_value (the amount, passed through).
Where it fits
The canonical wiring, straight from the readme: feed a canvas height into int_value and your mask height into subtracted_value; wire Result (INT) into the mask's Y position and subtracted_value into the mask's Height. Now your mask sits flush against the bottom edge and follows automatically when you resize it. More generally, use it any time one value is derived from another by subtraction and both need to travel downstream.
Install
ComfyUI Manager → Custom Nodes Manager → search ComfyUI_Mira → Install → restart. Or by hand: cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git, then restart. If the pack errors on load, run pip install -r requirements.txt in its folder. No downloads.
Common issues
Both inputs default to 0, so an untouched, unconnected node just outputs 0 - wire the values. Watch for negative results: this is integer subtraction, and if subtracted_value exceeds int_value you'll get a negative number, which a mask position or dimension input won't accept. Make sure the value you're subtracting from is the larger one for coordinate math. And if you need decimals, this is the integer node - there's a float multiplier for fractional work, though for subtraction specifically you're in whole numbers here.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| int_value | INT | 0 | — |
| subtracted_value | INT | 0 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Result (INT) | INT | — |
| Result (STRING) | STRING | — |
| subtracted_value | INT | — |