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

πŸ”Ή CYH Latent | Flux Aspect Ratio

Flux's awkward resolutions, without doing the math yourself

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

    Flux doesn't take kindly to arbitrary resolutions, and the community has quietly converged on a handful of sizes that actually work - 1344Γ—768 for widescreen, 1024Γ—1024 for square, 1152Γ—768 for 3:2. This node is basically a lookup table for those. You pick a ratio from a dropdown and it hands you an empty latent at the "right" Flux resolution, so you never have to remember whether it was 1344Γ—768 or 768Γ—1344 again.

    It's one of six aspect-ratio generators in the Chye ComfyUI Toolset pack, all built the same way. Where the built-in Empty Latent Image node makes you type numbers, these give you presets tuned to a specific model family - here, Flux (v1-dev and the .1/schnell era, where the 1024 base and its multiples were the sweet spot).

    How it works

    Under the hood it's embarrassingly simple, and that's a good thing. The dropdown label already bakes the resolution into the text - 16:9 (Widescreen) - 1344Γ—768 - so the node parses the ratio, looks it up in a table, applies your orientation and multiplier, rounds both dimensions to a multiple of 32, then creates a zeroed tensor:

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

    The // 8 is the VAE downsampling factor: you want pixel dimensions divisible by 32 so the latent ends up clean at /8. All you get out is a LATENT, exactly like ComfyUI's own Empty Latent Image - wire it into a KSampler's latent input and you're off.

    The inputs that matter

    Four inputs, and you'll mostly touch two of them:

    • aspect_ratio - five presets: 1:1 (1024Γ—1024), 4:3 (1280Γ—960), 3:2 (1152Γ—768), 16:9 (1344Γ—768), 21:9 (1792Γ—768). The resolution is right there in the label, which is the nicest thing about this node.
    • multiplier - scales the preset by 0.1–10.0 before rounding. This is the knob to watch: 16:9 at multiplier 2.0 is a 2688Γ—1536 latent, which is past where most Flux builds stay coherent in one pass. Keep it near 1.0 and upscale later if you want more.
    • orientation - Portrait/Landscape. Defaults to Portrait, which is a bit of a trap: the preset already gives you a landscape resolution, and this setting just swaps width/height. Set it to Landscape for a widescreen image and it's a no-op.
    • batch_size - 1–64, generates that many empty latents at once. Useful for grid runs, same as batch size on Empty Latent Image.

    Where it sits in a workflow

    CYH Latent | Flux Aspect Ratio β†’ KSampler β†’ VAE Decode is the whole trick. It replaces the classic dance of Empty Latent Image + math nodes when you want Flux's canonical ratios. Since the latents are all zeros, you can also feed one straight into an img2img or inpainting setup as a blank canvas.

    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 ComfyUI after. The dependency list is scipy and opencv-python (the chunky ones) plus requests and coloredlogs; you already have torch and numpy. One quirk: the README insists the pack needs a .git/.cnr-id file containing Chye-ComfyUI-Toolset or workflow loads can error - the git clone handles it, but if you installed from a zip, create it.

    Honest verdict

    If you're already happy typing numbers into Empty Latent Image, this changes nothing. If you generate a lot of Flux at widescreen and are tired of the arithmetic, it's a small quality-of-life win. Just remember the presets are Flux.1-era - Flux 2 and Klein live in a 1MP–2MP native band, and these sizes (0.6–1.4MP) still land inside it fine.

    Categorylatent

    Inputs (4)

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

    Outputs (1)

    NameTypeDescription
    LATENTLATENTβ€”