ResolutionSolver
Stop hand-computing width and height for every aspect ratio
- Width
- Height
Every model has a native resolution, and going far off it gives you doubled heads and stretched limbs instead of an image. But "generate at 1024" is only half the answer - what if you want a tall 3:4 composition or a wide 16:9 one? You're then doing mental math to keep the total pixel count sane while the two dimensions stay in ratio and stay divisible by 8. That's the exact chore ResolutionSolver ("Simple Latent Resolution Solver" in the node menu) exists to kill. It's a tiny calculator node, not a creative tool, and that's fine - it's the kind of thing that saves you from opening a spreadsheet mid-workflow.
How it works
You give it three inputs:
- base - your model's native resolution as a single number (512 for SD 1.5, 1024 for SDXL and most modern models).
- aspect - the ratio as a string like
3:4or16:9. - format - Portrait or Landscape.
Under the hood it's simple and honest: total pixels = base², split that area across the ratio, and round each side down to a multiple of 8. That /8 rounding is the important part - the VAE downsamples 8x per side, so dimensions divisible by 8 keep the latent math clean and avoid reshape errors. Two INT outputs, Width and Height, which you wire straight into an Empty Latent Image node.
The quirk you'll hit on day one
The Portrait/Landscape switch is not what it looks like. It doesn't detect orientation - it's a swap toggle: "Landscape" outputs (width, height) in the order you'd expect from the ratio, "Portrait" swaps them. So if you write 3:4 and select Landscape, you get Width=880, Height=1184 - a portrait-shaped image despite the label. The reliable recipe: write the aspect as width:height, pick Landscape, and you get the shape you wrote; use Portrait only when you want the two swapped. For 1:1 it doesn't matter at all, which is why the node feels broken for a square until you realize it's just doing nothing.
Second honest note: the results are approximations, not the exact ratios your model was trained on. For SDXL the trained portrait ratio is 896x1152; this node hands you 880x1184. Close enough that most people never notice the difference, and arguably better than nothing - but if you're chasing the absolute sweet spot, the trained-ratio table for your architecture still wins. Where this node genuinely shines is keeping the area constant: every ratio it produces is within rounding of base², so you don't end up accidentally doubling your VRAM use with a "slightly bigger" pair of dimensions.
Install
Same pack as GoogleTranslator and Parameters. ComfyUI Manager → search "SimpleTools" and install "ComfyUI SimpleTools Suit", or:
cd ComfyUI/custom_nodes
git clone https://github.com/celsojr2013/comfyui_simpletools
Restart ComfyUI. No model files, no extra Python packages needed for this node. It's thirty lines of arithmetic dressed as a node, but it's the arithmetic you'd otherwise redo every time you switch ratios.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| base | INT | — | |
| aspect | STRING | — | |
| format | COMBO | Portrait | 2 options: Portrait, Landscape |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Width | INT | — |
| Height | INT | — |