π Image Resolution Adjust
Let ComfyUI Do the Aspect-Ratio Math
- Adj. Width
- Adj. Height
- Result
Ever needed a 1024-wide image at the right height for its aspect ratio, without doing the multiplication yourself? That's a genuine recurring ComfyUI annoyance - and ImageResolutionAdjust (π Image Resolution Adjust, from ControlFlowUtils) is the node that does the arithmetic for you. You give it a source width/height, it gives you back adjusted dimensions that keep the aspect ratio sensible.
One thing to get straight first: this node works on dimensions, not pixels. It doesn't resize an actual image - it computes numbers. You feed the results into an Empty Latent Image or an upscale-by-size node. That's the point: your resolution can become a computed value that responds to your workflow's logic instead of a hardcoded widget.
The inputs that matter
- source_width / source_height - the current dimensions (defaults 512Γ512).
- scaling_factor - multiply dimensions directly. Factor > 1 scales width up; factor < 1 changes height instead (the author's quirk, and it matters: a factor of 2 doubles width only, not the whole image). If you want uniform scaling, set the other side to 0.1-style math yourself - or just use a target dimension instead.
- target_width / target_height - the normal way to use this node. Set one of them and the other is extrapolated to preserve aspect ratio.
- tolerance - how far the final width and height may drift from the exact ratio, in pixels. The output is forced to multiples of tolerance (default 32), which keeps dimensions latent-friendly. Bigger tolerance = looser fit, more speed-friendly numbers.
The outputs are Adj. Width and Adj. Height (both INT, ready for an Empty Latent) plus Result, a string that shows the calculation it performed - handy for a text display or a quick sanity check.
The quirks worth knowing
The scaling-factor asymmetry is the real gotcha. "Scaling factor 2" does not mean 2Γ in both dimensions - the description says values > 1 affect width and values < 1 affect height. It's tuned for upscaling workflows where you usually want to grow in one direction. If you find the results surprising, switch to target_width/target_height, which behave the way you'd expect.
If you set both target dimensions to the same value (or equal to source), it returns them unchanged - no calculation, since none is needed. And tolerance matters more than it looks: with default 32, a 16:9 source won't come out perfectly 16:9, it'll come out the closest multiple-of-32 approximation. That's deliberate, and it's exactly what samplers want.
For real upscaling pipelines this packs nicely with the pack's other nodes - compute a target size in a Data Monitor FORMULA, then use ImageResolutionAdjust to snap it to clean values. For a beginner, the one-line summary is: set target_width to your desired width, read Adj. Height, feed both into an Empty Latent.
Install
ImageResolutionAdjust ships in VykosX/ControlFlowUtils:
# ComfyUI Manager β Install Custom Nodes β search "ControlFlowUtils"
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/VykosX/ControlFlowUtils
Restart, find it under πΊ VykosX-ControlFlowUtils. No dependencies, no models. The repo even ships a sample workflow for this node, which shows the target-dimension pattern better than any explanation.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| source_width | INT | 51216β8192 | The original width of the image to adjust |
| source_height | INT | 51216β8192 | The original height of the image to adjust |
| scaling_factor | FLOAT | 1.00.1β10 | The scaling factor to multiply the image's dimensions by. > 1 values affect image width and < 1 values affect image height |
| target_width | INT | 51216β8192 | The new target width of the image where the new height can be automatically extrapolated from |
| target_height | INT | 51216β8192 | The new target height of the image where the new width can be automatically extrapolated from |
| tolerance | INT | 3216β1024 | How many pixels at most the target width and height should be from each other. Greater values result in greater differences |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Adj. Width | INT | Adjusted width of the image after calculation |
| Adj. Height | INT | Adjust height of the image after calculation |
| Result | STRING | String expression that displays the performed calculation |