ComfyUI Node

Simple Aspect Ratio

Stop typing 1216x832 — this node is a dropdown of sane resolutions

By wwwins·Created 3 years ago·Updated 2 years ago· 1
Simple Aspect Ratio
    • width
    • height
    aspectRatio
    orientation

    Simple Aspect Ratio is the rare custom node that has never once crashed anyone's ComfyUI, because it's one file and roughly twenty lines of logic. It doesn't call an API, needs no key, downloads no models, has no dependencies. Pick a ratio from a dropdown, flip a landscape/portrait toggle, and it hands you two integers: width and height. That's the entire job, and for a specific kind of workflow it's exactly what you want.

    Here's why it exists. Every diffusion checkpoint was trained at native resolutions - SDXL on 1024x1024 plus ratios like 1152x896, 1216x832 and 1344x768, SD 1.5 on 512-ish territory. Generate far off those and you get the classic anatomy soup: double heads, stretched limbs, repeating patterns. ComfyUI's stock Empty Latent Image just gives you two bare width/height boxes - no presets, no guardrails, and you have to know the magic numbers by heart. This node turns "pick a sane size" into a dropdown, which is a genuinely beginner-friendly idea.

    How it works

    Under the hood there's no math. Each entry in the aspectRatio list is a hardcoded string like "16:9 - 1344x768". The node splits off the WxH part and, if orientation is set to portrait, swaps the two numbers. That's it - read the source and you'll see the whole thing is a list literal, an if, and a return.

    The inputs and outputs that matter

    There are exactly two inputs, both dropdowns:

    • aspectRatio - 11 presets spanning 512x512 up to 1344x768, covering 1:1, 3:2, 4:3, 8:5 and 16:9.
    • orientation - landscape or portrait; portrait just swaps width and height (which is why 1:1 presets come out identical either way).

    The two outputs are width and height (INT). The 95% use case: wire both straight into Empty Latent Image's width/height inputs, then on to your KSampler. You can also feed them to any other node that takes INT dimensions - latent batch setups, conditioning areas, that kind of thing.

    Where people get burned

    Nothing here breaks on install - no requirements.txt, no model files, the Manager finds it by searching "Simple Aspect Ratio" or "wwwins". The real traps are expectations:

    • The list is fixed. No custom ratios unless you edit aspect_ratio_node.py yourself. It's a curated preset, not a calculator.
    • The labels are approximations. "16:9 - 1344x768" is actually 1.75, not 1.778; "8:5 - 1216x768" is 1.583. Close enough to matter not at all, but don't obsess over the math.
    • Pick the half of the list that matches your checkpoint. The 512–768 presets are for SD 1.5; the 1024-scale ones are the SDXL-trained ratios. Drop an SDXL model at 768x512 and you're back to the stretched-anatomy complaints the KB quotes from r/StableDiffusion.

    Honest take: if you generate at one resolution and never change it, skip this and type into Empty Latent Image. It earns its keep in shared template workflows, and when you flip between portrait and landscape all day. And for a beginner, it's the first time a resolution choice is actually labeled in a language you understand.

    Install

    ComfyUI Manager (search Simple Aspect Ratio or wwwins), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wwwins/ComfyUI-Simple-Aspect-Ratio
    

    Restart ComfyUI. That's the whole ceremony - there's nothing else to download.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    aspectRatioCOMBO11 options: 1:1 - 512x512, 1:1 - 768x768, 1:1 - 1024x1024, 3:2 - 768x512, 3:2 - 1216x832, 4:3 - 768x576, +5
    orientationCOMBO2 options: landscape, portrait

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT