M Int Mul (a * b)
Doubling sizes and scaling seeds without a scratch pad
- a_times_b
Multiplication is where a math node stops feeling like a toy and starts saving you from arithmetic mistakes. M Int Mul takes a and b (defaults 1 and 1, signed 32-bit) and returns a_times_b - one line of Python, zero surprises. But the reason to put it in a graph is the same reason you convert any widget to an input: the scale factor becomes a visible, editable part of the workflow instead of a number you recompute in your head.
The patterns that actually recur:
- Doubling or halving resolution. A base width of 512 wired through
a_times_bwith a factor of 2 gives you 1024 every time the base changes - no retyping, no mis-synced copies. Same trick for batch size. - Seed jumping. Multiply a seed by a constant to get a deterministic, well-spread sequence of variations. Ugly math by hand, trivial as a node.
- Composed scaling. Chain it with the pack's add/sub nodes for "width times two, minus a margin" as one visible expression instead of a comment in your head.
Both sockets take either typed values or wires, and it composes cleanly with the rest of the mnodes math family. The only real constraint is the 32-bit input clamp, which caps how big a product you can build before overflow - but for seeds, steps, and dimensions you'll never get near it. Output is plain INT, so it drops straight into any integer input you converted to a wire.
It ships in ComfyUiNodes (repo Madlumi/ComfyUiNodes, author "Madanie"), a small personal-toolbox pack of 18 int math nodes, two string helpers, and two workflow-glue nodes. Install via ComfyUI Manager - search "ComfyUiNodes" - or:
cd ComfyUI/custom_nodes
git clone https://github.com/Madlumi/ComfyUiNodes
Restart ComfyUI after that. No pip requirements, no model downloads - it's plain Python on top of what ComfyUI already ships. The node is under Add Node → mnodes → int.
One honest note: if you only ever do one multiply, this is overkill - a Primitive with a baked value works fine. The moment you're scaling several values from one base, though, this node pays for itself in a single workflow.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 1-2147483648–2147483647 | — |
| b | INT | 1-2147483648–2147483647 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| a_times_b | INT | — |