Size From Presets (SDXL)
A dropdown that hands you SDXL's trained w/h
- w
- h
The simplest node in the pack, and in some ways the most useful: a dropdown of SDXL's nine trained resolutions that outputs w and h as INTs. No latent, no batch, no RNG - just pick a preset and get two numbers. It's from nkchocoai's ComfyUI-SizeFromPresets, a minimal pack whose whole job is turning size presets (stored in a CSV) into values the rest of your graph can use.
Where does "just two numbers" earn its keep? Whenever the size isn't coming from a latent node you control. If you're using the core Empty Latent Image and want its width/height to match a preset, wire w/h into it. If some other node - a conditioning setup, an image resizer, a text-to-image tool that takes explicit dimensions - needs an integer size, this gives you a clean, reproducible source instead of hand-typing 1216 and 832 every time. It's also the natural building block for workflows that route the same size to multiple places.
How it works
The implementation is almost comically direct. The dropdown is built at import time from presets/sdxl.csv:
"1216 x 832" # one entry, parsed back to (1216, 832)
get_size() splits the chosen string on 'x', strips whitespace, and returns the two ints. Nothing else happens - no model call, no tensor, no random state. That's the point: when you just need the numbers, you don't want a node that does more.
The nine options are the SDXL trained ratios: 1024x1024, 1152x896, 896x1152, 1216x832, 832x1216, 1344x768, 768x1344, 1536x640, 640x1536. Staying on this list matters because SDXL was trained at ~1MP on these aspect ratios; generating off them invites stretched anatomy and duplicated limbs. This node keeps you honest with zero effort.
The one input
preset- the dropdown. That's the entire interface.
Outputs: w, then h, both INTs. Wire them into whatever needs a size.
Where people get burned
Honestly? Not much, because there's so little surface area. Two things worth knowing:
- The menu is whatever's in
presets/sdxl.csvwhen ComfyUI starts. Add a row, restart, and your custom size appears in the dropdown - reproducible, no code edits. But the list only refreshes on restart, so don't be surprised when an edit doesn't show up mid-session. - The pack locates that CSV by the hardcoded folder name
ComfyUI-SizeFromPresets. Rename the clone and every node in the pack fails at startup. It's GPL-3.0 licensed too, if you were planning to fork it.
There's also an SD1.5 flavor of this exact node (SizeFromPresetsSD15) with five smaller presets, and random variants that pick a preset from the same file via a seed - grab this one when you want a fixed, deliberate size and the random ones when you want the dice roll.
Install
Via ComfyUI Manager, search "ComfyUI-SizeFromPresets". Or clone:
cd <ComfyUI>/custom_nodes
git clone https://github.com/nkchocoai/ComfyUI-SizeFromPresets.git
Restart after installing, then find it under the SizeFromPresets category. No requirements.txt and no model downloads - the pack only needs the csv module, numpy, and torch, all already in any ComfyUI environment.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| preset | COMBO | 9 options: 1024 x 1024, 1152 x 896, 896 x 1152, 1216 x 832, 832 x 1216, 1344 x 768, +3 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| w | INT | — |
| h | INT | — |