Aspect Ratio Size Selector
Pick a ratio and a size tier instead of typing pixels
- width
- height
- batch_size
Instead of doing the arithmetic yourself every time ("what's 16:9 at roughly 2K, again?"), this node lets you pick an aspect ratio and a size tier from dropdowns and it hands you the actual width/height pixel values to feed your latent. It's a small node, but it removes a specific bit of friction that shows up constantly when you're switching between portrait, landscape, and square outputs across a session.
The controls
aspect_ratio- 16 choices, including1:1,1:2,3:5,5:3,2:1,3:1,1:3,9:16,16:9,3:4,4:3,2:3, plus four more beyond that list. Per the README, one of the options is an auto mode that passes yourinput_width/input_heightstraight through unchanged, instead of computing a ratio-based size - useful if you want this node purely for the divisibility rounding described below and not for picking a preset shape at all.size-1k,2k, or4k, the target resolution tier the aspect ratio gets applied at.divisible_by-none,8, or16. Rounds the computed width/height to a clean multiple.8matches the grid SD/SDXL/Flux VAEs actually downsample on;16is the coarser grid some newer or video-oriented architectures prefer. Same underlying reason this pack'sImageResizeTo8xnode exists - misaligned dimensions cause downstream rounding mismatches.batch_size- 1 to 4096, a pure pass-through. It doesn't affect the computed width/height at all; it just gives you a wiredbatch_sizeoutput so one node can feed both your size calculation and yourEmptyLatentImagewithout a separate primitive.input_width/input_height(optional, default 1024 each) - only relevant ifaspect_ratiois set to the auto/pass-through option.
Outputs: width, height, batch_size - all INT, ready to wire straight into a latent or resize node.
Choosing a size tier that matches your model
1k lines up closely with what SDXL was actually trained on - its documented trained buckets are 1024x1024, 1152x896, 1216x832, 1344x768, and 1536x640 (and their rotations), so several of this node's 1k-tier ratio outputs should land close to those numbers. 2k and 4k are squarely newer-model territory - Flux and its successors handle much higher resolutions comfortably, where SDXL would start producing duplicated anatomy or tiling if you pushed it that far without upscaling. Match the tier to what your checkpoint actually was trained at, not just to what output size you want the file to be.
Installing it
ComfyUI Manager: search "ComfyUI-utils-nodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. No dependencies, pure arithmetic.
Watch for
If your output size doesn't match what you expected, the first thing to check is whether aspect_ratio is actually set to a ratio, versus that auto/pass-through option - in pass-through mode, size is ignored entirely and you'll get back whatever input_width/input_height say, which is easy to forget you set months ago at their 1024 defaults.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 16 options: 1:1, 1:2, 3:5, 5:3, 2:1, 3:1, +10 | |
| size | COMBO | 3 options: 1k, 2k, 4k | |
| divisible_by | COMBO | 3 options: none, 8, 16 | |
| batch_size | INT | 11–4096 | — |
| input_widthopt | INT | 10241–8192 | — |
| input_heightopt | INT | 10241–8192 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| batch_size | INT | — |