Aspect Ratio (1024)
Stop doing resolution math in your head
- width
- height
- ratio
Pick a ratio. Pick which side stays fixed. Get width and height back. That's the entire node.
It exists because the obvious alternative is worse. The official Resolution Selector works backwards from a megapixel budget: you say "about 1 megapixel, 16:9" and it hands you 1344×768 or similar, which is fine until you want a specific short side - "portrait, 1024 wide, tall like a phone" - and now you're doing arithmetic in a text field. This one pins the side you care about and derives the other. The node's own docstring says as much.
How the math actually works
Three widgets, all required:
aspect_ratio- nine options:1:1,1:2,2:1,3:4,4:3,9:16,16:9,9:21,21:9. Default is9:16.lock_mode-Short Side (recommended),Fixed Width (width=base), orFixed Height (height=base).base_side- INT, default 1024, min 16, max 8192, step 16.
In Short Side the node compares the two ratio numbers and picks a family: if width > height it's landscape and height gets pinned to base_side; if width < height it's portrait and width gets pinned. 1:1 pins both. Fixed Width and Fixed Height just force one of those branches regardless of which orientation the ratio is.
Whatever comes out gets rounded to the nearest multiple of 16 (minimum 16), which is why the numbers look slightly off any hand calculation you did. At the default 1024: 21:9 → 2384×1024, 16:9 → 1824×1024, 4:3 → 1360×1024, 9:16 → 1024×1824, 1:1 → 1024×1024.
Three outputs: width (INT), height (INT) and ratio (STRING). Width and height go into Empty Latent Image's width/height. ratio is the string you already picked, echoed back - it exists so you can hand the same ratio to another node without retyping it.
What the ratio output is for
This is the part that's easy to miss. Three other nodes in the pack - Cinematic Frame & Subtitle, Prompt Director - share this exact ratio list and this exact calc_size() function. Prompt Director's LLM picks a ratio for your composition and clamps it into that list; convert this node's aspect_ratio widget to an input and you can wire Director's aspect_ratio string straight in, and the sizing node and the cinematic crop then agree by construction. No copy-pasting 21:9 into three widgets and getting one of them wrong.
The ratio string output is the reverse direction - one sizing node feeding the ratio to other nodes.
Resolution sanity, since you're picking sizes now
Picking a ratio doesn't mean every ratio is a good idea for every model. SDXL-lineage checkpoints were trained on a discrete set of ratios (1024×1024, 1152×896, 1216×832, 1344×768, 1536×640 and their rotations), and going far off those is the classic source of the "why is my body stretched" post. 3:4 and 4:3 at 1024 are well inside the family; 9:21 is not, and you should expect to upscale-and-crop or accept some softness there.
The 2026 generation loosened this a lot - Z-Image, Klein and friends take anything in a roughly 1–2MP band and degrade softly instead of duplicating anatomy. Flux wants dimensions divisible by 64; 16-aligned values like 1824 aren't automatically 64-aligned, so if you're on Flux and something looks off, nudge base_side and check. And note the node aligns to 16, not 8: it's more conservative than the minimum SDXL needs, which is the safe direction.
Install
ComfyUI Manager → search ComfyUI-FeiFei, or:
cd ComfyUI/custom_nodes
git clone https://github.com/aifeifei798/ComfyUI-FeiFei.git
# restart ComfyUI; nodes appear under the FeiFei category
Nothing to download. The pack's dependencies are numpy, Pillow and openai>=1.40, and this node uses none of them - the sizing is arithmetic.
Gotchas worth knowing before you wire it
base_sidesteps by 16. Typing 1000 in the UI is possible in some frontends; the node rounds it to 1008 anyway. Trust the output, not the field.- Older workflows may carry Chinese lock-mode labels. The node maps the legacy
固定短边 (推荐)/固定宽度 (width=基准)/固定高度 (height=基准)strings onto the English ones, so a workflow saved against an earlier version still resolves instead of silently falling back. - Short Side is the right default, and the reason is compute.
21:9stays 1024 high rather than 2384 wide, so a panoramic frame doesn't quadruple your latent size. Only reach forFixed Width/Fixed Heightwhen a downstream node genuinely needs a specific pixel value. - It's a value node, not a loader. If nothing appears in your graph after adding it, that's correct - you need an Empty Latent Image (or equivalent) to wire the
width/heightinto. This is plumbing in the purest sense; the whole point is one authoritative source for the size instead of four places you can forget to update.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 9:16 | 9 options: 1:1, 1:2, 2:1, 3:4, 4:3, 9:16, +3 |
| lock_mode | COMBO | Short Side (recommended) | 3 options: Short Side (recommended), Fixed Width (width=base), Fixed Height (height=base) |
| base_side | INT | 102416–8192 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| ratio | STRING | — |