Nodes/ComfyUI-GTSuya-Nodes/Random SDXL Resolutions
ComfyUI Node

Random SDXL Resolutions

Pick from SDXL's actual trained aspect ratios

By GTSuya-Studio·Created 3 years ago·Updated 5 months ago· 14
Random SDXL Resolutions
    • width
    • height
    modeAll
    seed0

    SDXL wasn't trained at one resolution - it was trained across a specific list of width/height pairs, all landing around one megapixel, from a 1536×640 wide banner shape down to 640×1536 tall portrait, with 1024×1024 square in the middle. That list isn't arbitrary; it's baked into how SDXL's positional encoding understands the frame, which is exactly why tools like Fooocus hardcoded resolution pickers to that same set instead of letting people type in whatever numbers they wanted. Stray too far off those trained ratios and composition gets weirder, not just cropped differently. This node is the ComfyUI version of that same idea: instead of you remembering nine magic numbers and manually swapping Empty Latent Image every time you want variety, it picks one for you.

    How it works

    Nothing clever under the hood - it's a fixed lookup table of the official SDXL resolutions (four landscape, four portrait, one square), filtered by whichever orientation you ask for, then a random pick from whatever's left after filtering. Set mode to Landscape only and you'll only ever get wide shapes; leave it on All and every orientation is in play.

    Inputs and outputs

    • mode - dropdown: All, Landscape only, Portrait only, Square only. Filters which subset of the resolution list is eligible.
    • seed - reproducibility, same as everywhere else in this pack. Connect it to your global seed if you want a specific "random" resolution to repeat.

    Two outputs, both INT: width and height. Wire them straight into an Empty Latent Image node's width/height fields, or into a KSampler if your workflow takes dimensions there - no manual math needed on your end.

    The full list it draws from: landscape 1536×640, 1344×768, 1216×832, 1152×896; square 1024×1024; portrait 896×1152, 832×1216, 768×1344, 640×1536.

    Installing it

    ComfyUI Manager: search ComfyUI-GTSuya-Nodes, install, restart. Or by hand: cd ComfyUI/custom_nodes && git clone https://github.com/GTSuya-Studio/ComfyUI-Gtsuya-Nodes.git, restart. It's a static lookup table - no models, no network calls, nothing to download.

    Where people get burned

    The one thing to actually get right: this list is SDXL's trained resolutions specifically. That covers SDXL itself and its anime derivatives that share the same architecture - Illustrious, NoobAI, Pony - because they all inherited SDXL's positional setup. It does not apply to SD 1.5 (which trained around 512×512) or to Flux and other newer architectures with their own native resolution ranges; wiring this node's output into a non-SDXL-family checkpoint gets you numbers that are simply irrelevant to what that model learned. Second, smaller trap: width and height are INT outputs, so if a downstream node expects a STRING or a different numeric type you'll need a conversion node in between - a one-time fix, but easy to miss the first time you wire this up.

    Categoryutils/resolution

    Inputs (2)

    NameTypeDefaultDescription
    modeCOMBOAll4 options: All, Landscape only, Portrait only, Square only
    seedINT00–18446744073709550000

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT