Subtract
DF_Subtract – ComfyUI Node from Derfuu_ComfyUI_ModdedNodes
- FLOAT
DF_Subtract does exactly what it says: Value_A - Value_B, output as a float. It's the other half of DF_Sum in Derfuu_ComfyUI_ModdedNodes, a math-and-utility pack that's been part of ComfyUI since 2023, back when doing arithmetic mid-graph meant reaching for a node like this one rather than typing a formula into a widget.
The usual reason you'd want this: computing a gap or a remaining amount between two sizes that only exist as values inside the graph. Say you've read an image's actual dimensions with DF_Get_image_size and you need to know how much padding is left after subtracting a fixed border, or you're computing the difference between a target resolution and a source resolution to feed into a scale calculation. Anywhere you'd write a - b on paper, this is the node-graph equivalent.
Inputs and output
Two required FLOAT inputs:
- Value_A - the number you're subtracting from
- Value_B - the number being subtracted
Order matters here, unlike DF_Sum where A and B are interchangeable - swap the two and you'll flip the sign of your result. One output: FLOAT, equal to Value_A - Value_B. It's worth noting the result can come out negative, and this pack has a dedicated node for handling that if you need to guarantee a sign - DF_Absolute_value, which can force the output positive or negative depending on a toggle.
Where it fits
Like the rest of the pack's basic math nodes, this is connective tissue rather than a destination - you'll find it sitting between a couple of size- or value-reading nodes (DF_Get_image_size, DF_Get_latent_size) and whatever consumes the result downstream, usually another math node or eventually a DF_Ceil/DF_Floor to get back to an integer. If your workflow doesn't do custom arithmetic on dimensions or values, you're unlikely to need it at all.
Installing
The pack installs as one repository - you can't pull just this node on its own. Through ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart ComfyUI. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes
then restart. No models, no unusual Python dependencies - it's plain arithmetic under the hood, so install is quick and low-risk.
Troubleshooting
If DF_Subtract doesn't appear in the node search right after installing, restart the ComfyUI server and hard-refresh your browser tab - that's the fix for the vast majority of "installed but not showing up" cases, and it's a generic frontend-cache quirk that isn't specific to this pack.
One thing worth being aware of with this pack specifically: its maintainer has, in the past, deleted deprecated nodes outright on updates rather than keeping a legacy version around, which has broken old workflows for people who leaned on it heavily. The core arithmetic nodes - Sum, Subtract, Divide and so on - have been stable since the pack's early days and aren't the ones that have historically been pruned, so this is more of a general heads-up than a specific concern for DF_Subtract. If a much older workflow throws a missing-node error elsewhere after you update the pack, that maintenance history is the first place to look.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| Value_A | FLOAT | 1.00 | — |
| Value_B | FLOAT | 1.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |