Aspect Ratio (nikosis)
Aspect Ratio (nikosis) — ComfyUI Node Guide
- latent
- width
- height
If you've ever stared at ComfyUI's stock "Empty Latent Image" node and wondered why your Flux or SD3 generation came out warped, this node exists for exactly that reason. SDXL and Flux/SD3 don't use the same latent shape - SDXL's VAE outputs 4 channels, Flux and SD3 output 16 - and the core "Empty Latent Image" node only knows about the 4-channel world. Get it wrong and you're not looking at a subtle quality hit, you're looking at a tensor-shape crash the moment the sampler tries to run. Aspect Ratio (nikosis) folds that decision into one dropdown so you can't forget it, and throws in a curated list of sane resolutions on top.
What it actually does
Every model family has a native resolution it was trained at, and drifting far from it is a known way to get stretched limbs, duplicated heads, or repeating tile patterns - this isn't superstition, it's the same "you're using a model trained on 1024x1024 trying to make wildly different aspect ratios" complaint that shows up constantly in troubleshooting threads. SDXL's trained ratios cluster around 1024x1024, 1152x896, 1216x832, 1344x768, and their rotations; Flux and SD3-family models are looser but still want something in the 1-2 megapixel range, divisible by 64. Instead of doing that math yourself, this node ships a preset list of ready-made width/height pairs tagged by their aspect ratio, so you pick "4:3 landscape" instead of guessing at 1152x896.
Under the hood it's still building an empty LATENT tensor - the same "start from nothing, let the sampler fill it in" step every txt2img workflow needs - it's just doing it with the right channel count and a sane size baked in.
The inputs that matter
- model_type -
SDXLorSD3/Flux. This is the important one: it decides whether the latent gets 4 channels (SDXL) or 16 (SD3, Flux, and by extension anything else on that newer VAE family). Match this to your checkpoint or the sampler will throw a shape-mismatch error before it does anything useful. - preset_dims - a dropdown of curated aspect-ratio/resolution pairs (portrait and landscape,
customis the default). Leave it oncustomto type your own numbers, or pick a preset and skip the math. - width / height - used when
preset_dimsiscustom. Range is 16 to 16384, and they'll get rounded to a clean multiple of 8 internally, because that's what the VAE's 8x spatial downscale actually needs. - swap_dimensions - flips width and height without you retyping either one. Handy for turning a landscape preset into a portrait shot on the fly.
- batch_size - how many empty latents to stamp out at once, 1 to 64, for batch generation.
Outputs: latent goes straight into your KSampler. width and height come back out as plain integers - useful if a downstream node (a resize, a mask, an overlay) needs the actual numbers rather than reading them off the latent tensor.
Installing it
Easiest path is ComfyUI Manager - search for "ComfyUI-Nikosis-Nodes" and install from there. Manual route: cd ComfyUI/custom_nodes && git clone https://github.com/Nikosis/ComfyUI-Nikosis-Nodes, then pip install -r requirements.txt inside the cloned folder (Windows portable users run that through python_embeded\python.exe -m pip install -r requirements.txt instead), then restart ComfyUI. In practice the requirements list here is close to nothing - the pack's own notes say it works with ComfyUI's standard setup with no extra installs needed, so don't expect a long dependency chain or any model downloads. This is one of the low-risk, easy custom node installs in an ecosystem that's otherwise notorious for dependency conflicts between packs.
Where people get tripped up
Wrong model_type = crash, not just bad output. If you load an SDXL checkpoint but leave model_type on SD3/Flux (or vice versa), you'll get a channel-count mismatch the instant the KSampler touches the latent - this is one of the more confusing errors for beginners because the failure message talks about tensor shapes, not "you picked the wrong model type." If your run dies immediately with a size-mismatch error, check this dropdown first.
Custom dimensions that ignore the model's native range. Typing in something wildly off from what your checkpoint was trained on - even with the right channel count - is still how you get stretched anatomy and repeated patterns. If you're not using a preset, stay in the neighborhood of what your model actually saw during training rather than reaching for extreme numbers because the slider allows it.
Node not showing up after install. Standard ComfyUI Manager gotcha, not specific to this pack: a fresh custom-node install needs a full restart (not just a page refresh) before it appears in the node search, and if you installed manually, double-check it landed inside ComfyUI/custom_nodes/ and not one directory off.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model_type | COMBO | SD3/Flux | 2 options: SDXL, SD3/Flux |
| preset_dims | COMBO | custom | 29 options: custom, 1:2 portrait 704x1408, 11:21 portrait 704x1344, 4:7 portrait 768x1344, 3:5 portrait 768x1280, 13:19 portrait 832x1216, +23 |
| width | INT | 102416–16384 | — |
| height | INT | 102416–16384 | — |
| swap_dimensions | BOOLEAN | false | — |
| batch_size | INT | 11–64 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width | INT | — |
| height | INT | — |