Select SDXL Dimensions
An SDXL dimension dropdown that also builds the latent
- width
- height
- latent
- upscale factor
- upscaled width
- upscaled height
Every SDXL regular has this muscle memory: drag in an EmptyLatentImage, stare at the width/height boxes, and try to remember whether 9:7 was 1152×896 or 896×1152. One digit off and you get a double-headed portrait instead of a person. Select SDXL Dimensions replaces that whole guess with a dropdown of the nine aspect ratios the community actually settled on - and it hands you a properly-sized empty latent at the same time, so you don't even need the EmptyLatentImage node anymore.
What it actually does
It's a combo box with nine presets, and every one sits in the ~1MP band that SDXL was trained around (they run 0.98–1.05 megapixels): 1024×1024, 1152×896 and its portrait twin, 1216×832, 1344×768, 1536×640, and the rest. That range is the point. SDXL's native resolution is 1024, and generating far off it is how you get duplicate anatomy and stretched limbs - the presets stay close enough to native that you don't fight the model.
Pick one and the node does two things. It emits width and height as plain integers, and it allocates a latent: four channels at height÷8 by width÷8, which is exactly what SDXL's VAE expects (1024×1024 becomes a 128×128 latent). Mechanically it's a dictionary lookup that calls torch.zeros, so it's instant and costs you nothing. The latent is byte-for-byte the same kind of object EmptyLatentImage produces - wire it straight into a KSampler's latent input and generate.
The inputs and outputs that matter
Three inputs, and honestly only one of them is interesting:
- dimensions - the dropdown. This is the node.
- upscale_factor - default 2.0, range 1.0–8.0 in 0.25 steps. It doesn't upscale anything; it's there for the math below.
- batch_size - default 1. Set it to 4 and you get a latent that already holds four images, which beats patching four latents together for a batch run.
Outputs: width, height, latent, plus upscale factor, upscaled width, upscaled height. Those last three are the sneaky useful part. The node computes width × factor for you, so you can wire upscaled width and upscaled height into a latent upscale node and run the classic two-pass hires fix: generate at a native-ish ~1MP preset, then do a second pass at 2× with low denoise to add detail. It's a nice shortcut, just be clear-eyed that it's doing arithmetic, not upscaling.
Installing it
Part of the small ComfyUI-LatentPresets pack (three dimension nodes, GPL v3, single author). No Python dependencies beyond ComfyUI itself and no model files to download:
cd ComfyUI/custom_nodes
git clone https://github.com/bnwa/ComfyUI-LatentPresets
Then restart ComfyUI. Via ComfyUI Manager, use Install via Git URL with that same address - the pack isn't registered in the Manager's registry yet, so searching its name finds nothing.
Where people get burned
The one real gotcha is version, and it's written right at the top of the README: this pack uses the new comfy_api.latest v3 node API and requires a ComfyUI 0.3.x or newer build. On an older install the nodes just don't appear in the menu - no error, no hint. If you cloned the pack and see nothing under models/latent, update ComfyUI first, not the pack.
The other trap is architectural: this node's latent is four-channel, which is SDXL-only. Plug it into a Flux or Z-Image sampler and you'll get garbage, because those use 16-channel VAEs. Same pack has dedicated nodes for each - use the one that matches your model. Small utility, but it kills a whole class of typo and ratio mistakes, and that's worth a few seconds of install time.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dimensions | COMBO | 9 options: 1024 × 1024 (1:1) — Square, 1152 × 896 (9:7) — Landscape, 896 × 1152 (7:9) — Portrait, 1216 × 832 (19:13) — Photo Landscape, 832 × 1216 (13:19) — Photo Portrait, 1344 × 768 (7:4) — Wide Landscape, +3 | |
| upscale_factor | FLOAT | 2.001–8 | — |
| batch_size | INT | 1 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| latent | LATENT | — |
| upscale factor | FLOAT | — |
| upscaled width | INT | — |
| upscaled height | INT | — |