Random Resolution Selector
Test landscape, portrait, and square from one prompt
- width
- height
- display
It doesn't generate anything. Random Resolution Selector is a tiny math node from fudosanit/ComfyUI-Random-Resolution that takes one base width/height and hands back either the original, the swapped (portrait↔landscape) version, or a square - chosen at random (or not). That's the whole job, and it's exactly the job you want when you're staring at a prompt and wondering whether it reads better wide, tall, or square.
People do this manually all the time: queue a batch, edit the Empty Latent Image dimensions between runs, squint at the results. This node automates the fiddly part. The author's framing - "test the same prompt as vertical, horizontal, and square compositions in one go" - is the whole pitch, and it's a legitimately useful one for character design, thumbnails, and anything where composition is the variable you're testing.
How it works
The mechanism is plain arithmetic, and since it's a custom/resolution node that runs entirely on CPU with the Python standard library (random, time), there's no GPU cost, no model files, no dependencies. The behavior is fully deterministic once you know the seed, which makes it predictable in a way that's worth understanding before you trust it blindly:
random_toggleon: the seed picks a mode viaseed % 3-0= original,1= swapped (width and height trade places),2= square (both set to(height + width) / 2).random_toggleoff: always outputs the original pair. The seed is ignored.
The inputs that matter
- width / height (defaults 1152 × 896, min 1) - your base composition. Those defaults are SDXL-flavored landscape; if you run SD 1.5 or Flux, set them to something your model actually likes, because randomizing away from the model's trained resolution is how you get soft, mushy results.
- random_toggle (default on) - the master switch. Off = boring, on = the point of the node.
- seed_behavior (
fixed/randomize/increment, defaultrandomize) - decides what happens to the seed.randomizedraws a fresh random seed per run (yourseedinput is ignored).fixeduses your seed as-is.incrementadds 1 to a shared counter every run.
Here's the subtle bit that will bite you: with random_toggle on, one run shows you one mode, not all three. randomize just picks a random mode each time. To actually test the trio, set seed_behavior to fixed and queue seeds 0, 1, 2 - that walks you through original, swapped, square in order, guaranteed.
Wiring the outputs
Three outputs: width (INT) and height (INT) feed straight into whatever creates your latent - Empty Latent Image for SD-family models, or the equivalent latent-size node for newer architectures. display (STRING) is a human-readable line like width: 1152, height: 896 (seed: 123, mode: original) - pipe it into a text display node if you want to see which mode ran, or just watch it in the node's own widget preview.
Installing it
No models, no requirements.txt, nothing heavy. Either search "Random Resolution" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes/
git clone https://github.com/fudosanit/ComfyUI-Random-Resolution.git
Restart ComfyUI and it's under the custom/resolution category.
Gotchas
- The
incrementcounter is global - a class-level variable that persists for the whole ComfyUI process and is shared across every instance of the node. Two selectors in one graph step on each other's seeds. Usefixedorrandomizeunless you have one and only one of these in your workflow. - Feed it even numbers. The square mode averages the two dimensions; with odd inputs you'll get non-multiple-of-8 latents, which most models handle poorly or not at all. The defaults (1152 + 896 → 1024) land cleanly, but garbage in, garbage out.
- Random resolution is a nice exploration tool, not a free lunch. Models are trained on specific aspect ratios, and the more you drift from them, the more anatomy and detail suffer. Keep your base pair inside your model's sweet spot and let the swap/square variants do the wandering.
For a one-function node it's well-behaved and has exactly one job - which is more than you can say for a lot of micro-packs. If you batch-test compositions regularly, it earns its place next to Impact Pack and rgthree in the "actually useful QoL" drawer.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| height | INT | 896 | — |
| width | INT | 1152 | — |
| random_toggle | BOOLEAN | true | — |
| seed | INT | 0 | — |
| seed_behavior | COMBO | randomize | 3 options: fixed, randomize, increment |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| display | STRING | — |