Nodes/SDVN_Comfy_node/⚑️ Empty Latent Ratio
ComfyUI Node

⚑️ Empty Latent Ratio

Pick an aspect ratio, skip the pixel math

By StableDiffusionVNΒ·Created 2 years agoΒ·Updated about a month agoΒ· 118
⚑️ Empty Latent Ratio
    • latent
    β—„ratioβ–Ύβ–Ί
    β—„maxsize1024β–Ί

    Every text-to-image workflow starts with an empty latent, and the stock node makes you type exact pixel dimensions. This one lets you pick an aspect ratio from a dropdown - 16:9, 2:3, 1:1, whatever - and set a single max-size value, and it does the pixel math for you. That's the whole pitch, and it's a genuinely nice quality-of-life win because it stops you from either memorizing SDXL's "good" resolutions or accidentally typing dimensions that don't play well with the model.

    If you generate at a bunch of different aspect ratios, this is the node that makes switching a one-click change instead of a two-field retype-and-hope.

    How it works

    You choose a ratio and a maxsize. The node computes width and height that match that ratio, bounded so neither dimension exceeds maxsize, and returns a blank LATENT at that size ready to feed into your KSampler. Because it derives both dimensions from the ratio, they stay proportional and land on model-friendly sizes rather than arbitrary ones.

    The inputs and outputs that matter

    Only two inputs, and both matter:

    • ratio - the shape. Nine presets: 1:1, 4:5, 5:4, 2:3, 3:2, 16:9, 9:16, 1:2, 2:1. That covers square, portrait, landscape, and the wide/tall extremes.
    • maxsize - the size budget (default 1024, up to 4096). Think of it as "the long edge won't exceed this." For SDXL, 1024 keeps you near the ~1MP sweet spot the model was trained on; for SD1.5, drop it to 512-768.

    Output is a single latent - wire it straight into your sampler's latent_image.

    How to install it

    ComfyUI Manager: search SDVN_Comfy_node, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node
    

    then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from your ComfyUI root, and restart. It's under SDVN β†’ Image.

    Common issues & troubleshooting

    Blurry, doubled, or incoherent output. The classic cause is generating too far from the model's native resolution. If you set maxsize to 2048 and run raw SDXL, you'll get the "two heads" mess - that's the model, not the node. Keep maxsize near 1024 for SDXL, 512-768 for SD1.5, and upscale afterward instead of generating huge.

    The ratio I want isn't in the list. There are nine presets and no free-form entry. If you need something exotic, use the stock Empty Latent Image with manual dimensions, or generate at the nearest preset and crop.

    Dimensions seem slightly off from the exact ratio. That's intentional - the node snaps to sizes the latent space can represent (multiples of 8), so a 16:9 at 1024 won't be pixel-perfect 16:9. This avoids sampler errors and is the right trade.

    Wrong batch size. This node makes a single empty latent. If you want a batch, use a Repeat Latent Batch downstream or the stock empty-latent node's batch field.

    CategoryπŸ“‚ SDVN/🏞️ Image

    Inputs (2)

    NameTypeDefaultDescription
    ratioCOMBO9 options: 1:1, 4:5, 5:4, 2:3, 3:2, 16:9, +3
    maxsizeINT10240–4096β€”

    Outputs (1)

    NameTypeDescription
    latentLATENTβ€”