RecalculateSize01
The width × magnification node that replaces a four-node INT/FLOAT chain
- width
- height
If you've ever done a hires-fix pass in ComfyUI, you've done this math by hand: type the base width into a node, then type width × 1.5 into a calculator, then type that number back in. RecalculateSize01 exists to make that a single node. Feed it a Width, a Height, and a Magnification, and it hands you back the two scaled integers, ready to plug into an upscaler or an EmptyLatentImage.
It's a math node, not a hype node. It generates nothing, needs no model, and calls no API. What it does is collapse a genuinely annoying little workflow into one box.
How it works
The node is about as simple as ComfyUI nodes get - roughly ten lines of Python. It reads the two dimension widgets and the magnification float, multiplies them, and casts the result back to integers:
w = Width * Magnification
h = Height * Magnification
return(int(w), int(h))
There's one behavior worth knowing before you trust it with odd multipliers: that int() truncates, it doesn't round. 512 × 1.33 gives you 680, not 681. For hires-fix targets you almost never care - 1.5x and 2x land on clean numbers. But if you're chasing a specific resolution or multiples of 8 for latent dimensions, round your magnification up to something that lands clean instead of assuming the node did.
The author's stated reason for building it is refreshingly honest: wiring width through a conversion when you need it as a FLOAT, doing the multiply, then converting back takes three or four nodes, and node count was the complaint. This is that whole chain in one. And because the README's big tip is to right-click the node and pick Convert Widget to Input, you can route Width and Height from upstream (say, an image's actual dimensions) instead of typing them - the multiply stays inside this node.
The inputs and outputs that matter
- Width (INT, default 512, min 1) - your starting width.
- Height (INT, default 512, min 1) - your starting height.
- Magnification (FLOAT, default 1, range 0.01 to 9999.99) - the scale factor. This is the only input you'll actually fiddle with after wiring up the other two.
Outputs are two INTs, named width and height. They wire straight into the width/height inputs of ImageScale, LatentUpscale, or EmptyLatentImage - the classic hires-fix second pass, where the KB's upscaling guidance puts 1.5–2x as the sweet spot. Nothing fancy, but exactly the two numbers you'd otherwise type by hand.
Install
Zero-dependency, which in this ecosystem is a feature. There's no requirements.txt, no model download, no torch flavor to fight with - the node only imports ComfyUI's own modules. The easy path is ComfyUI Manager: search for ComfyUI_mittimiRecalculateSize (or just "RecalculateSize") and hit install. Or, the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/mittimi/ComfyUI_mittimiRecalculateSize
Restart ComfyUI, and it appears under the mittimiTools category. That's the whole install.
Gotchas
There aren't many, because there isn't much to break. A couple of small things: the pack's __init__.py has a copy-pasted docstring describing a different mittimi node ("switch between vertical and horizontal values") - harmless, but mildly confusing if you read the source expecting this one. And the author is an honest hobbyist who says so in the README - "I am not a professional, if there is a bug please tell me" - so treat this as a small utility, not something to build a career on. It's a genuinely quiet pack: you won't find reddit threads about it, and that's fine. It's the kind of node you install once, forget you have, and quietly reach for every time a workflow asks you to scale something. For a one-node pack that replaces a four-node chain, that's a good deal.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Width | INT | 5121–2147483647 | — |
| Height | INT | 5121–2147483647 | — |
| Magnification | FLOAT | 1.000.01–9999.99 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |