Nodes/rgthree's ComfyUI Nodes/SDXL Empty Latent Image (rgthree)
ComfyUI Node Runs on cloud

SDXL Empty Latent Image (rgthree)

SDXL Empty Latent Image (rgthree)

By rgthree·Created 3 years ago·Updated 13 days ago· 3,294
SDXL Empty Latent Image (rgthree)
    • LATENT
    • CLIP_WIDTH
    • CLIP_HEIGHT
    dimensions1024 x 1024 (square)
    clip_scale2.0
    batch_size1

    SDXL Empty Latent Image is a starting-canvas node with SDXL's blessed resolutions baked into a dropdown, so you stop typing 1216 x 832 from memory and hoping you got a shape SDXL actually likes. Pick a resolution from the menu, and it hands you an empty latent to sample into - plus the target CLIP dimensions SDXL wants for its conditioning. It's a small convenience, but it removes two of the most common SDXL setup mistakes in one node.

    Why you'd reach for it

    SDXL is picky about resolution. It was trained on a specific set of aspect-ratio buckets, and straying from them - say, generating at a plain 512×512 out of SD1.5 habit - gives you soft, badly-composed, sometimes duplicated results. The stock Empty Latent node happily lets you type any dimensions, including the wrong ones. This node instead offers the correct SDXL resolutions as a dropdown, from 1536×640 landscape through 1024×1024 square to 640×1536 portrait. Choose one and you're guaranteed to be in a bucket the model understands.

    The second thing it does is hand you the CLIP target dimensions SDXL's conditioning uses. SDXL's text encoders take width/height parameters to steer composition, and those want to reference a larger "target" size than the latent itself. This node computes those for you from a scale factor, so you're not deriving them by hand.

    Inputs and outputs

    Three inputs, and only the first is one you'll fuss over:

    • dimensions - a dropdown of SDXL's supported resolutions (default 1024 x 1024 (square)). This is the one you set per image; pick the aspect ratio you want.
    • clip_scale - a multiplier (default 2) that determines the CLIP target dimensions relative to the chosen resolution. The default is the common choice; leave it unless you know you want otherwise.
    • batch_size - how many latents to generate at once (default 1).

    Outputs are a LATENT (the empty canvas - wire it into your KSampler's latent input) plus CLIP_WIDTH and CLIP_HEIGHT integers. Feed those two into the width/height parameters of your SDXL conditioning (or a Context Big that carries them) so the encoders get the target size they expect.

    Installing it

    SDXL Empty Latent Image is part of rgthree-comfy. Install through ComfyUI Manager (search rgthree's ComfyUI Nodes) or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rgthree/rgthree-comfy.git
    

    Restart ComfyUI afterward. No models, no heavy dependencies - the pack is graph and UI code.

    Common issues

    The point of confusion is the two sizes: the latent resolution (from the dimensions dropdown) and the CLIP target dimensions (the CLIP_WIDTH/CLIP_HEIGHT outputs) are not the same number, and that's intentional. The latent is what you sample at; the CLIP dimensions are a larger reference the SDXL encoders use to steer composition. Wire each to its right place - LATENT to the sampler, CLIP_WIDTH/HEIGHT to the conditioning - and don't try to force them equal.

    Second, this is an SDXL node. Using it in front of a non-SDXL model still produces a valid empty latent, but the CLIP dimension outputs are meaningless to a model that doesn't take them, and the resolution buckets are tuned for SDXL specifically. For SD1.5 or other architectures, the stock Empty Latent node is the right tool.

    And the pack-wide caveat: if the node renders oddly, check whether ComfyUI's Nodes 2.0 frontend is enabled. The Vue rewrite broke several rgthree nodes and the standing workaround is to keep it off.

    Categoryrgthree

    Inputs (3)

    NameTypeDefaultDescription
    dimensionsCOMBO1024 x 1024 (square)9 options: 1536 x 640 (landscape), 1344 x 768 (landscape), 1216 x 832 (landscape), 1152 x 896 (landscape), 1024 x 1024 (square), 896 x 1152 (portrait), +3
    clip_scaleFLOAT2.01–10
    batch_sizeINT11–64

    Outputs (3)

    NameTypeDescription
    LATENTLATENT
    CLIP_WIDTHINT
    CLIP_HEIGHTINT