Nodes/ComfyUI-Multi-Lora/Resolution Switcher
ComfyUI Node

Resolution Switcher

A preset drawer for latent resolutions

By Danchi93·Created 3 months ago·Updated 6 days ago· 9
Resolution Switcher
    • LATENT
    presets[]

    Resolution Switcher is a dropdown-in-spirit for the one number you retype constantly: your generation size. It replaces the stock EmptyLatentImage node with a little table of presets - width, height, batch - where you toggle the row you want and it spits out a blank latent at that size. If you've ever sat in front of ComfyUI manually typing 896×1152, generating, then deleting and typing 1152×896, this is aimed squarely at you.

    The resolution is worth being deliberate about, not just convenient. Every model has a native resolution and a handful of trained aspect ratios; step off them and you get stretched bodies, duplicate anatomy, or soft degradation instead of just "a bigger image". SDXL's trained ratios (1024×1024, 1152×896, 1216×832, 1344×768, 1536×640) are exactly the sort of thing you want parked in presets so flipping between them while testing a prompt is one click, not three keystrokes. This node makes that flipping painless.

    How it works

    Under the hood it's honest: it builds torch.zeros([batch, 4, height//8, width//8]) and wraps it in a latent dict - literally the same blank-latent recipe as ComfyUI's native EmptyLatentImage. It defaults to 1024×1024 at batch 1, snaps width/height down to multiples of 8 (min 16, matching how latent space is 8× downsampled), and if the preset data is somehow garbage it falls back to the default rather than erroring. Defensive, boring, correct.

    The interesting part lives in the frontend, which is a custom DOM widget. You get rows with a toggle capsule, W/H/batch number inputs, and a delete button, plus an "Add Resolution" button. The toggles are radio-style: exactly one preset is active at a time, because a resolution switcher that could switch to nothing would be useless. Editing W and H snaps them to multiples of 8 as you type. Your presets serialize into the saved workflow JSON, so they survive saving, reloading, and sharing.

    The inputs and outputs that matter

    There's exactly one input, presets - a JSON string that holds your list of {active, width, height, batch} rows. You never actually type it: the widget hides the underlying field and edits it for you. The one output is LATENT, which wires straight into a KSampler (or anything else that takes a latent). Add it, set your favorite sizes, connect the latent to the sampler, done.

    Installing it

    No dependencies, no model downloads, nothing. Just the repo and a restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Danchi93/ComfyUI-Workflow-Tools
    

    Then restart ComfyUI. Or use ComfyUI Manager and search "ComfyUI-Workflow-Tools". The whole pack is pure Python plus bundled JS - no requirements.txt, so no pip pain and nothing to conflict with your other nodes. It ships from the Danchi93/ComfyUI-Workflow-Tools repo, alongside the Multi LoRA Loader, Prompt Segments, and friends.

    Gotchas worth knowing

    The easy miss: editing W/H on a row that isn't the active one changes nothing about your output until you toggle it on. The active row is the green-tinted one. Check it before wondering why nothing changed.

    Also remember what this node is for. The latent it emits is blank - it's a generation start, not an image. If you want a resolution preset for img2img or a VAE encode, that's a different node; this one only feeds the "make a fresh empty latent" path. And since it's a custom node, any workflow you download that uses it will nag you for the missing pack - that's the standard ComfyUI custom-node tax, resolved by Manager or the clone above.

    It's a small tool. But it's the kind of small tool that quietly deletes a hundred keystrokes a day, and for a brand-new pack with zero dependencies, that's a fair trade.

    Categorylatent

    Inputs (1)

    NameTypeDefaultDescription
    presetsSTRING[]

    Outputs (1)

    NameTypeDescription
    LATENTLATENT