Random Image Size Advanced (watdafox)
An empty latent generator that knows the 'right' sizes for SDXL, Flux and Qwen
- LATENT
- width
- height
- NX_LATENT
- nx_width
- nx_height
- resolution_multiplier
- str_result_1x_resolution
- str_result_nx_resolution
Random Image Size Advanced is an Empty Latent Image that got opinions. Instead of making you type a resolution, it carries curated preset lists per model family - SDXL, Qwen, Flux, and Flux2 - lets you pick one at random or lock one in, and (the genuinely useful part) hands you two latents: one at your chosen size and one at a scaled-up "nx" size for the upscale pass.
The reason this earns its keep is that resolution choice is where ComfyUI newcomers and veterans alike produce garbage. Generating far above a model's native training resolution triggers the tiling/repetition artifacts everyone hits; generating too small wastes detail. The presets in this node are the community-agreed sane sizes for each family - Flux's native-ish range around 1MP, SDXL's portrait/landscape spread around 1024², Qwen's taller ratios, and Flux2's much larger sizes. It won't make you a resolution expert, but it stops you from casually typing 2048x2048 into an SDXL graph and wondering why everything repeats.
How it works
Set random_pick_state to a preset key (SDXL/Qwen/Flux/Flux2) or All and it picks randomly from that pool on every run; set it to None and the image_size dropdown (a flat list of every preset entry) becomes your fixed choice. width_override/height_override (0 = off) force an exact resolution regardless. When not overridden, the picked size is rounded down to a multiple of 64 - latent-space math, and a classic source of "why is my image 1024x1024 not 1025x1025" confusion if you don't know it's happening.
The second latent is the multiplier trick: resolution_multiplier (default 1.5) scales the picked size up into NX_LATENT/nx_width/nx_height. So for a hires-fix-style flow you get the base latent and a ready-made bigger latent in one node, instead of computing the upscale target yourself.
The outputs that matter
LATENT,width,height- base latent plus its dimensions (handy if you need the numbers as values).NX_LATENT,nx_width,nx_height,resolution_multiplier- the scaled-up latent and dims for a second pass.str_result_1x_resolution/str_result_nx_resolution- the sizes as strings, e.g.1024x1024and1536x1536, shown in the node's own widgets and ready for metadata.
Also note add_random_resolutions and override_random_resolutions text fields let you inject your own sizes into the random pool at runtime - parseable as NUMBERxNUMBER separated by commas, semicolons, or spaces.
Category: watdafox/latent.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/OhSeongHyeon/comfyui-watdafox-nodes.git
Restart ComfyUI, or ComfyUI Manager → "comfyui-watdafox-nodes". No pip dependencies, no downloads.
Where the two siblings differ
This version's presets are hardcoded in the source. The nearly identical Random Image Size YAML reads the same lists from yaml/model_resolutions.yaml, so you can edit them without touching code - and it tries to re-sync its dropdowns if your local YAML differs from the one in a downloaded workflow. If you only ever use the shipped sizes, this one's fine; if you want your own preset groups, the YAML sibling is the one to reach for.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| batch_size | INT | 11–64 | — |
| random_pick_state | COMBO | 6 options: None, All, SDXL, Qwen, Flux, Flux2 | |
| image_size | COMBO | 75 options: SDXL 704x1408, SDXL 704x1344, SDXL 768x1344, SDXL 768x1280, SDXL 832x1216, SDXL 832x1152, +69 | |
| width_override | INT | 00–16384 | — |
| height_override | INT | 00–16384 | — |
| resolution_multiplier | FLOAT | 1.500.01–10 | — |
| add_random_resolutions | STRING | — | |
| override_random_resolutions | STRING | — | |
| str_result_1x_resolution | STRING | — | |
| str_result_nx_resolution | STRING | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |
| width | INT | — |
| height | INT | — |
| NX_LATENT | LATENT | — |
| nx_width | INT | — |
| nx_height | INT | — |
| resolution_multiplier | FLOAT | — |
| str_result_1x_resolution | STRING | — |
| str_result_nx_resolution | STRING | — |