Image_计算器工具2.0
A four-function calculator that hands back INT and STRING
- INT
- STRING
Sometimes you just need arithmetic in a graph - total pixel budget, half the width, double the steps - and reaching for a Python node feels like overkill. Image_计算器工具2.0 ("calculator tool 2.0") is the ComfyUI-AC_FUNV2.0 pack's answer: a dropdown, two numbers, one result.
There are three inputs. MahtExpression (yes, misspelled - don't search for "Math") is the operator dropdown with four options: SUM+, SUB-, MUL*, DIV/. Then int_1 and int_2, both integer widgets, defaulting to 0 with a range up to 100,000,000,000,000,000. Pick an operator and the node does plain Python arithmetic - add, subtract, multiply, or divide - and returns the result on two outputs: an INT and the same number as a STRING (e.g., "42"). The string output exists because plenty of things in ComfyUI want text, not numbers.
The trap: the default for int_2 is 0, and DIV/ divides int_1 by int_2. Select DIV with the defaults still in place and you get a ZeroDivisionError - the node just fails on run. There's no guard, no friendly "pick a nonzero divisor" message. So the workflow is: pick your operator first, then set the numbers, and if you're dividing, make sure int_2 isn't zero before you hit Queue.
Also worth knowing: int_1 and int_2 are plain widget inputs, not forceInput sockets. You type into them; you can't wire values in from other nodes unless you use the Convert widget to input trick. That makes this a manual calculator, not a piece of live graph math - fine for computing a one-off resolution, less useful for a value that changes with every run.
What people actually use it for is resolution plumbing: int_1 * int_2 to get the megapixel count of a canvas, or dividing to compute a half-size for a hires pass. The STRING output is the nicest part - wire it into a filename builder or a display node and you get "1024x1024" as text for free.
Install is the pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/A719689614/ComfyUI-AC_FUNV2.0
restart, then find it under ♑AC_FUNV2.0. No models, no dependencies beyond stock ComfyUI.
Honest take: if you already run Impact Pack or any node pack with a math node, this adds nothing you don't have. It's a convenience bundled into this toolbox because the author's tutorials needed a calculator without pulling in another dependency. If you're running this pack anyway and need an occasional sum or product, it's right there in the same category - just remember to change int_2 off 0 before you hit DIV, and remember the input name is spelled MahtExpression.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| MahtExpression | COMBO | 4 options: SUM+, SUB-, MUL*, DIV/ | |
| int_1 | INT | 00–100000000000000000 | — |
| int_2 | INT | 00–100000000000000000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| STRING | STRING | — |