Nodes/Chye ComfyUI Toolset/πŸ”Ή CYH Latent | SDXL Aspect Ratio
ComfyUI Node

πŸ”Ή CYH Latent | SDXL Aspect Ratio

SDXL aspect ratios without the stretched-body lottery

By chyerΒ·Created about a year agoΒ·Updated 6 months agoΒ· 1
πŸ”Ή CYH Latent | SDXL Aspect Ratio
    • LATENT
    β—„aspect_ratio16:9 (Widescreen) - 1024Γ—576β–Ί
    β—„orientationPortraitβ–Ί
    β—„multiplier1.0β–Ί
    β—„batch_size1β–Ί

    SDXL was trained on a fixed set of resolutions near 1 megapixel, and generating far outside that band is how you get stretched bodies, duplicate limbs, and that unmistakable "I asked for widescreen and got a horror show" look. This node hands you an empty latent at SDXL-friendly sizes from a dropdown, so you can stop rolling the dice on odd resolutions.

    It's part of the Chye ComfyUI Toolset's latent category - one of six aspect-ratio generators sharing the same design, but this one tuned to SDXL's native 1024 base rather than Flux's or Qwen's.

    How it works

    Nothing clever, and that's the point. The preset label embeds the resolution (16:9 (Widescreen) - 1024Γ—576), the node parses it, applies your orientation and multiplier, rounds to a multiple of 32, then emits a zeroed tensor:

    latent = torch.zeros([batch_size, 4, final_height // 8, final_width // 8])
    

    Standard empty-latent behavior, output type LATENT, straight into KSampler β†’ VAE Decode. Zero model downloads, zero extra weights.

    The presets

    • 1:1 - 1024Γ—1024
    • 4:3 - 1024Γ—768
    • 3:2 - 1152Γ—768
    • 16:9 - 1024Γ—576
    • 21:9 - 1344Γ—576

    All of these sit in the 0.5–1.2MP band, which is where SDXL behaves. Note the pack's table isn't identical to the classic "SDXL trained ratios" list (1024Γ—1024, 1152Γ—896, 1216Γ—832, 1344Γ—768, 1536Γ—640) - the pack throws in 1024Γ—768 and 1152Γ—768, which are SDXL-adjacent rather than textbook. It doesn't matter much in practice; they're all within the safe band, and going off the exact training set only costs you a little quality, not broken anatomy.

    The inputs that matter

    Three you'll actually set:

    • aspect_ratio - the five presets above.
    • multiplier - scales the preset 0.1–10.0. This is the one to respect: crank 16:9 to 2.0 and you're at 2048Γ—1152, well past SDXL's 1MP comfort zone in a single pass. Keep it at 1.0–1.25 and upscale after.
    • orientation - Portrait/Landscape, default Portrait. Same quirk as the other nodes in this pack: the presets are written in landscape terms, so leaving the default Portrait swaps 1024Γ—576 into 576Γ—1024. Set it deliberately.

    Batch size (1–64) stacks identical blank latents for grid runs.

    Where it fits

    The classic SDXL advice - generate at a trained ratio, then hires-fix or upscale - is exactly what this node automates. It replaces Empty Latent Image plus a mental lookup table. If you're on a non-SDXL fine-tune like Illustrious or NoobAI (which stay within the SDXL framework), these sizes apply there too.

    Install

    ComfyUI Manager (search "Chye ComfyUI Toolset"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chyer/Chye-ComfyUI-Toolset
    cd Chye-ComfyUI-Toolset
    pip install -r requirements.txt
    

    Restart afterward. Dependencies: scipy and opencv-python are the notable ones, plus requests and coloredlogs; torch and numpy come with ComfyUI. Zip installs need the .git/.cnr-id file (Chye-ComfyUI-Toolset) the README calls out to avoid workflow-load errors.

    Honest verdict

    For SDXL regulars this is a genuine convenience - a tiny node that removes a recurring piece of arithmetic. It won't change your image quality, because nothing about an empty latent changes quality; it just keeps you inside the band where SDXL does its best work.

    Categorylatent

    Inputs (4)

    NameTypeDefaultDescription
    aspect_ratioCOMBO16:9 (Widescreen) - 1024Γ—5765 options: 1:1 (Square) - 1024Γ—1024, 4:3 (Standard) - 1024Γ—768, 3:2 (Photo) - 1152Γ—768, 16:9 (Widescreen) - 1024Γ—576, 21:9 (Ultrawide) - 1344Γ—576
    orientationCOMBOPortrait2 options: Portrait, Landscape
    multiplierFLOAT1.00.1–10β€”
    batch_sizeINT11–64β€”

    Outputs (1)

    NameTypeDescription
    LATENTLATENTβ€”