EmAySee Random Orientation Latent
Portrait or landscape? Let the seed decide
- latent
- width
- height
An Empty Latent that rolls a die on orientation. You give it a width, a height, and a seed; with random mode on it keeps the same total area and just swaps which dimension is width and which is height, so a 512x768 becomes 768x512 about half the time. Great for batch runs where you want a mix of portrait and landscape outputs without hand-editing the latent every time.
How it works
The node builds an empty latent of batch_size blank samples at width×height - the same 8x-downsampled 4-channel tensor a normal Empty Latent produces, so you can wire it straight into a KSampler. The trick is the random_orientation toggle:
- random_orientation (default off) - when on, it uses the seed to flip a coin. Heads keeps your width/height, tails swaps them. When off, it's just an Empty Latent with extra reporting.
- width (512) and height (768) - your base dimensions, stepped by 8 and capped at ComfyUI's max resolution.
- batch_size (1) - number of blank latents. Useful if you're generating a set and want them to inherit different orientation rolls.
- seed - drives the coin flip only. It doesn't touch your sampler's seed unless you wire the node's INT outputs into it.
Outputs are latent, plus width and height as INTs - the actual post-flip dimensions. Wire those into a conditioning or a text node and your prompt can respond to the orientation. That's the nice part of this node: it doesn't just swap silently, it tells you which way it went.
Why you'd bother
If you're making a contact sheet or a batch of concept variations, locking every output to one orientation gets monotonous fast. This gives you an even portrait/landscape split with zero extra UI. Want a different ratio? Change the base dimensions - it always preserves the total area, so no surprise resolution jumps.
The honest caveats
It's a coin flip, not a weighted choice - 50/50, no odds slider. And the swap is exact: 512x768 in, 768x512 out, no intermediate sizes. If you want a three-way split (square/portrait/landscape), this isn't the node for it.
Installing it
From ComfyUI_EmAySee_CustomNodes - ComfyUI Manager (search the pack) or:
cd ComfyUI/custom_nodes
git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
# restart ComfyUI
Found under EmAySee/Latent. No dependencies, no model files - it's just torch.zeros with a dice roll on top.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 51216–16384 | — |
| height | INT | 76816–16384 | — |
| batch_size | INT | 11–4096 | — |
| random_orientation | BOOLEAN | false | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width | INT | — |
| height | INT | — |