Nodes/YARS: Yet Another Resolution Selector/yaResolution Selector (Advanced)
ComfyUI Node

yaResolution Selector (Advanced)

A Resolution Selector That Respects Your Pixel Count (and Your VRAM)

By Tropfchen·Created 3 years ago·Updated 2 years ago· 18
yaResolution Selector (Advanced)
    • width
    • height
    base_resolution512
    width_ratio1
    height_ratio1
    overextendfalse
    constant_resolutionfalse

    The basic yaResolution Selector gives you a dropdown of preset ratios. The Advanced version is the one the pack's author actually tells you to reach for - and it earns the recommendation with a trick the preset node can't do: holding your pixel count constant at any aspect ratio.

    Same family, same deal. You give it a base_resolution (512 for SD 1.5, 1024 for SDXL and most current models), it returns two clean width and height integers, and you wire those into your Empty Latent, ImageScale, or LatentUpscale. The difference is that instead of a preset list, you type the ratio directly as width_ratio and height_ratio - any pair from 1 to 1024. No 13-item dropdown, no editing a text file. If the ratio exists, you can type it.

    The mode that matters: constant_resolution

    This is the one worth understanding. With constant_resolution on, the node ignores the ratio math and instead works backwards from a fixed pixel budget: it holds the total pixel count at base_resolution² and derives dimensions from your ratio. Set base_resolution to 1024 and any ratio you pick lands at roughly one megapixel - the same ballpark as SDXL's trained resolutions like 1216x832 and 1344x768, so you're never asking the model to render at a resolution it never saw.

    That's also why it's a VRAM tool. If you know your card starts OOM-ing past a certain megapixel count of latent, set base_resolution to roughly that ceiling and every aspect ratio you choose stays under it. Pick a wild 21:9 at a 1024 base and you get ~1564x670 - about 1MP, still polite to a 6GB card. The README pitches it exactly this way: set the max your GPU can safely handle, then get any ratio for free.

    The other two knobs

    • overextend - behaves exactly like the basic node's. Off (default), the longer side is capped at base_resolution; on, the base becomes the short side and the long side grows. 2:1 at a 512 base: 512x256 normally, 1024x512 overextended.
    • constant_resolution - and here's the gotcha: the two modes don't compose. The code checks constant_resolution first and, if it's true, ignores overextend entirely. If you flip overextend and nothing happens, this is why - turn constant_resolution off.

    Speaking of overextend without constant_resolution: extreme ratios can balloon. 21:9 at a 1024 base with overextend on is ~2388x1024, about 2.3MP of latent. Fine on a big card, a rude surprise on a laptop GPU.

    Install and wiring

    No separate install - it ships in the same pack as the basic node, so if you have yaResolution Selector, you already have this one. ComfyUI Manager, search "yaResolution Selector", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Tropfchen/ComfyUI-yaResolutionSelector
    

    Restart, done. Zero dependencies, zero model downloads.

    You get the same right-click convenience: Prepend Advanced yaResolution Selector on an Empty Latent Image (or ImageScale / LatentUpscale) drops the node in place and auto-connects its width and height to the target's widgets. The three inputs you'll actually touch are base_resolution, width_ratio, and height_ratio - the defaults are all 1, so change the ratios or you'll spend a confused minute looking at a 1:1 output. After each run the node shows a live readout of the resolution and megapixels, which is worth a glance when you're testing how far your VRAM actually stretches.

    If I were dropping a resolution selector into a template I planned to reuse across models and projects, this is the one I'd put in. Presets are nice; an arbitrary ratio plus a constant pixel budget is the version that doesn't need maintaining.

    Categoryutils

    Inputs (5)

    NameTypeDefaultDescription
    base_resolutionINT512512–8192
    width_ratioINT11–1024
    height_ratioINT11–1024
    overextendBOOLEANfalse
    constant_resolutionBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT