Resolution switcher
Roll the dice on portrait vs landscape
- ui_widget
- width
- height
- is_landscape
Batching fifty prompts and getting fifty identical portrait crops gets boring fast. LF_ResolutionSwitcher exists to add variety to your batches the lazy way: it randomly picks between a portrait and a landscape resolution based on a percentage you control, and hands you the width, height, and a "which one did we get" flag. It's one of the nodes the author explicitly called out as a favorite, and once you've used it you'll see why - it's the cheapest way to stop your batch output from looking like a contact sheet of the same image.
The single knob that matters is chance_landscape, a percentage from 0 to 100 (default 20). Set it to 20 and roughly one in five images comes out landscape; 0 makes everything portrait, 100 makes everything landscape. You then define the four dimensions: portrait_width / portrait_height (defaults 832×1216) and landscape_width / landscape_height (defaults 1216×832). Those defaults are the classic SDXL pairs, which tells you this node was born in the SDXL era - but there's nothing SDXL-specific about it, and you'll want to retune them for whatever resolution your current model actually wants. On a flow-matching model that expects 1024², feeding it 1216×832 is still fine (it's the same megapixel class), but check your model card rather than trusting the defaults.
Outputs are as simple as the inputs: width and height feed directly into your EmptyLatentImage (or whatever resolution-aware node you use), and is_landscape is a boolean you can wire into a switch if you want to do something different with landscape outputs - different prompt, different upscale path, whatever. Because it's a Logic-category node, that's the whole job: decide, don't generate.
Mechanically, there's a random roll per execution, so each prompt in a batch rolls the dice independently. That's exactly what you want for variety. There's no seed input here - if you need deterministic resolution, this node isn't the tool (the pack's seed-generation nodes are).
One workflow it's great in: style/character tests where you want to see the subject at both orientations without manually toggling a fixed dimension. Set chance_landscape to 50, batch 20 prompts, and you get a naturally mixed gallery. Just don't use it for anything where resolution consistency matters (training prep, print) - this node is deliberately nondeterministic, and that's the feature.
Install: ComfyUI Manager → "LF Nodes", or git clone https://github.com/lucafoscili/comfyui-lf into custom_nodes, then restart. And the pack note that applies everywhere here: comfyui-lf is legacy/frozen (early 2025) but fully functional; the new home is lucafoscili/lf-nodes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| chance_landscape | FLOAT | 200–100 | Percentage chance for landscape output, 0-100. |
| portrait_width | INT | 832 | Width when the image is portrait-oriented. |
| portrait_height | INT | 1216 | Height when the image is portrait-oriented. |
| landscape_width | INT | 1216 | Width when the image is landscape-oriented. |
| landscape_height | INT | 832 | Height when the image is landscape-oriented. |
| ui_widgetopt | KUL_PROGRESSBAR | [object Object] | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| is_landscape | BOOLEAN | — |