Nodes/ComfyUI-SDXL-EmptyLatentImage/SDXL Empty Latent Image
ComfyUI Node

SDXL Empty Latent Image

A resolution picker that remembers what you actually use

By shingo1228·Created 3 years ago·Updated about a year ago· 37
SDXL Empty Latent Image
    • LATENT
    resolution
    batch_size1

    The stock Empty Latent Image node gives you two number boxes and expects you to already know that SDXL wants 1024x1024, or 1216x832 if you're going landscape, or 832x1216 if you're not. Nobody actually memorizes that table. This node turns it into a dropdown, then goes one step further than most of the resolution-picker nodes out there: it keeps score. Use a size a few times and it starts marking it in the list, so the resolutions you actually reach for rise above the ones you picked once by accident.

    That's a real complaint people had - back when SDXL first landed, the go-to gripe on r/comfyui was exactly "I want an Empty Latent Image node with a dropdown instead of typing width and height," and this pack is the answer that got passed around. It's held up fine since; it's a small, single-purpose tool that hasn't needed much beyond that.

    Why the dropdown matters, not just for convenience: SDXL was trained on a specific set of aspect ratios - 1024x1024, 1152x896, 1216x832, 1344x768, 1536x640 and their rotations - and going off that grid is how you get stretched anatomy and duplicated limbs rather than a bigger picture. Typing "1920x1080" because that's what your monitor is produces exactly that failure. A dropdown built from the actual trained set removes the temptation.

    How it works

    The node loads resolution presets from JSON files that ship in the repo - sdxl_resolution_set.json (the SDXL-optimal ratios above) and sd_resolution_set.json (the SD1.5 standard set) - and lists them by category in priority order: your own Custom entries first, then SDXL, then SD15, sorted portrait → square → landscape within each group. Every time you run with a given resolution, it logs the pick to a local usage_stats.json and starts decorating the label: a ★ for anything you've manually flagged as a favorite, a 🔥 once you've used it three or more times, a 🕒 for your five most recent picks. It's a most-used cache built directly into the widget, so the sizes you actually work in stop hiding at the bottom of a 33-entry list.

    Underneath, it's still just building the same empty tensor the stock node does - batch, channels, height/8, width/8. The README also documents a 16-channel mode for SD3/Flux-style latents alongside the default 4-channel SDXL/SD1.5 mode, but that's a config.json / SDXL_DEFAULT_CHANNELS environment-variable setting, not something exposed as a per-run input here - so treat it as a one-time setup choice, not something you flip mid-session.

    resolution is the dropdown itself - 33 preset entries in this pack's schema, each formatted like 832 x 1216 (0.68), width by height by decimal aspect ratio. Match the category to your checkpoint: SDXL entries for an SDXL model, SD15 entries if you're still on 1.5.

    batch_size is the usual integer, 1 to 64, default 1 - how many empty latents to stamp out in one go.

    The single output, LATENT, plugs into your KSampler's latent input exactly like the stock node's does. Nothing downstream needs to know you swapped nodes.

    Installing it

    Search ComfyUI-SDXL-EmptyLatentImage in ComfyUI Manager and install, or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/shingo1228/ComfyUI-SDXL-EmptyLatentImage
    

    Restart ComfyUI to pick it up. There's nothing to download - the whole extension is one Python file plus the bundled JSON resolution lists, no external dependencies and no model weights.

    Common issues

    Favorites don't appear when you expect them to. There's no right-click "add to favorites" in the node UI - you mark a resolution as a favorite by hand-editing usage_stats.json and adding its exact label string to the favorites array. If you were expecting a button, that's why it's not there.

    Custom resolutions aren't showing up. The dropdown only lists the two bundled sets until you create custom_resolution_set.json yourself in the extension's folder, as a JSON array of {"width": ..., "height": ...} objects. No file, no Custom category.

    Node's missing after install. Standard custom-node gotcha, not specific to this pack: a git clone only takes effect after a full ComfyUI restart, not a page refresh.

    You need something past the defaults. Max resolution (8192), min resolution (64), and max batch size (64) are all overridable through SDXL_* environment variables or config.json if a particular preset or batch size gets rejected - unlikely for a beginner workflow, but it's there if you script something unusual.

    Categorylatent

    Inputs (2)

    NameTypeDefaultDescription
    resolutionCOMBO33 options: 512 x 512 (1.00), 688 x 512 (1.34), 768 x 512 (1.50), 912 x 512 (1.78), 512 x 688 (0.74), 512 x 768 (0.67), +27
    batch_sizeINT11–64

    Outputs (1)

    NameTypeDescription
    LATENTLATENT