Int Multiple and Add Literal
Do ax + b math inline instead of wiring up a math node
- x
- ax + b
- ax + b(float)
Every graph eventually needs a little arithmetic wedged into it - scale a dimension by 1.5, add a fixed offset to a seed, bump a batch count by a constant. You could reach for a general-purpose math-expression node for that, but IntMultipleAddLiteral does exactly one thing, does it with three plain number widgets, and doesn't ask you to remember expression syntax: it takes a number, multiplies it by a, adds b, and hands you the result as both an int and a float.
What it's for
It's the small connective-tissue node you reach for when a value coming out of one part of your graph needs a linear transform before it goes into the next - x → ax + b - without pulling in a full math-expression node just to write x * 1.5 + 64. Think: deriving a target width from an aspect-ratio value, nudging a seed by a fixed step across a batch, or computing a padded size from a base dimension.
How it works
number comes in as your x. The node multiplies it by a (with a_aign controlling whether that multiplication is applied as positive or negative - flip it to negative and you're effectively subtracting a·x instead of adding it), then adds b. That's the whole computation. It also just passes number straight through as its own output, so you get your original value and the transformed one out of the same node without needing a separate pass-through.
The inputs and outputs that matter
number(INT, default 0, 0–1,000,000) - yourx, the required input.a(FLOAT, default 1, step 0.001) - the multiplier. Fine step size means you can dial in fractional scale factors precisely.a_aign(positiveornegative, defaultpositive) - sign of the multiplication. Yes, it's a typo for "a_sign" baked into the node itself - this pack is a solo dev's personal utility grab-bag, not a polished commercial extension, and it shows in small spots like this without affecting how it works.b(INT, default 1, step 1) - the additive offset.
Three outputs: x (your original number, unchanged), ax + b (the result rounded to an int), and ax + b(float) (the same result at full float precision) - useful if downstream you need the precise value rather than a rounded int, e.g. feeding a ratio into something that expects a float.
How to install it
Via ComfyUI Manager: search "ComfyUI-utils-nodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. This is pure arithmetic - no model downloads, no extra Python dependencies, one of the lightest nodes in the pack to get running.
Common issues & troubleshooting
The main thing to watch is which output you're actually wiring downstream. It's easy to grab ax + b out of habit and get integer rounding you didn't want, when ax + b(float) was the one that preserved your precision - check which one the next node in your chain actually expects.
The other thing worth knowing before you rely on it: number is clamped 0–1,000,000 and can't go negative, so if your x genuinely needs to be negative, you'll want to do that sign flip on the a/b side of the equation instead, or feed a positive magnitude and apply the sign downstream. Beyond that there's not much to trip over - it's three widgets and one formula, and that's the whole point of a node like this.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| number | INT | 00–1000000 | — |
| a_aignopt | COMBO | positive | 2 options: positive, negative |
| aopt | FLOAT | 1.000 | — |
| bopt | INT | 1 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| x | INT | — |
| ax + b | INT | — |
| ax + b(float) | FLOAT | — |