Aspect Ratio (Seb)
Aspect Ratio (Seb) does the math
- width
- height
Every model has a native resolution, and generating at the wrong shape is how you end up with stretched anatomy, duplicated limbs, or that classic "why does this look like a funhouse mirror" moment. Aspect Ratio (Seb) is a two-output utility node that takes the guesswork out of sizing: you pick a ratio and a target size, and it hands you ready-made width and height integers to feed straight into Empty Latent Image.
The stock workflow equivalent is doing this by hand - knowing that SDXL wants 1152x896, 1216x832, 1344x768, or similar trained ratios and typing them in. This node is that arithmetic, automated, with one genuinely useful trick up its sleeve.
How it works
It's plain math, which is why it's reliable. You pick an aspect ratio (there are 12 presets, from tall 9:19.5 mobile portrait through 1:1 square out to 21:9 anamorphic, plus a Custom option where you type your own custom_aspect_width and custom_aspect_height). Then you pick a control mode:
- Megapixels - you set
target_megapixels(default1.0) and the node solves for dimensions that give roughly that many pixels in the shape you chose. The point, per the README, is consistent VRAM usage and generation time across different ratios - so when you're A/B testing composition, the only thing changing is the shape. - Fixed Side - you lock one side (
fixed_side_axis= Width or Height) atfixed_side_value, and the node computes the other side to match the ratio.
Finally, everything gets rounded to the nearest multiple_of (default 8). That step is not cosmetic - your latent math and most model architectures want dimensions divisible by 8, and SDXL's native shapes only exist at specific multiples. Leave it at 8.
A nice touch in the shipped UI: irrelevant widgets hide themselves. Choose Custom and the custom width/height fields appear; switch control modes and the megapixels fields swap for the fixed-side fields. Less clutter than the average ComfyUI node, which is a small miracle.
The inputs that matter
preset- the ratio. Most of what you want is here without thinking.control_mode/target_megapixels- Megapixels mode is the one to reach for while experimenting.multiple_of- 8 by default and that's where it should stay for normal SDXL/Flux work.
Wiring it up
The two outputs, width and height, plug into any node that takes dimensions - most obviously Empty Latent Image, but also upscalers and any custom node that wants an INT pair. Since it's just numbers, you can also run two copies for a portrait/landscape A/B.
Installing it
Install via ComfyUI Manager (search "Seb"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/cyberhirsch/seb_nodes
# restart ComfyUI
No model files, and the only real dependency is the pack's bundled JavaScript for the show/hide UI behavior. If the widgets don't collapse for you, you've got the pack's JS disabled - check that the js folder shipped intact.
Worth repeating the caveat from the README and the model docs: "right aspect ratio" means "within the model's trained range," not "any number that's a multiple of 8." This node happily hands you a valid-looking 21:9 at 1.0 MP that an SDXL model may not have trained on - the ratio math is right, the model's anatomy rules are your problem. For the sane stuff, though, this is the fastest way from "I want a phone wallpaper" to a correct-size latent.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| preset | COMBO | 1:1 (Square) | 12 options: 9:19.5 (Mobile Portrait), 9:16 (Tall Portrait), 2:3 (Portrait), 3:4 (Portrait), 4:5 (Social Media Portrait), 1:1 (Square), +6 |
| custom_aspect_width | INT | 16 | — |
| custom_aspect_height | INT | 9 | — |
| control_mode | COMBO | Megapixels | 2 options: Megapixels, Fixed Side |
| target_megapixels | FLOAT | 1.00.1–64 | — |
| fixed_side_value | INT | 102464–8192 | — |
| fixed_side_axis | COMBO | Width | 2 options: Width, Height |
| multiple_of | INT | 8 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |