Nodes/(R) Resolution Switcher/(R) Resolution Switcher
ComfyUI Node

(R) Resolution Switcher

Named resolution presets in one dropdown

By raduchits·Created about a month ago·Updated about a month ago· 0
(R) Resolution Switcher
    • width
    • height
    preset

    The name is a mouthful, but the job is plain: (R) Resolution Switcher is a dropdown that outputs a width and a height, and you decide what's in the dropdown. Save "SDXL Portrait" once and it becomes a 832x1216 you never type again.

    You reach for this the moment you start testing aspect ratios seriously. Generating at 1024x1024, then 832x1216, then 1216x832 is one of the most common loops in ComfyUI, and every swap means retyping numbers into EmptyLatentImage. If you've already gone down the "convert widget to input" path from the plumbing playbook, you're retyping into a primitive node instead - barely better. Resolution-preset nodes exist to kill exactly this friction; there's a well-upvoted r/comfyui tutorial for building one by hand, which tells you it's a real itch. The catch with most of them: the preset list is hardcoded in Python, so adding a resolution means editing the file and restarting. This one doesn't work that way, and that's its whole selling point.

    How it works

    Two-layer trick. The Python side is almost insultingly simple - a STRING input called preset, a lookup in a JSON file, and out come two INTs. All the personality lives in the frontend JS, which swaps that plain text field for a real combo dropdown and adds the Add/Delete buttons. Those buttons talk to three tiny HTTP routes the node registers on ComfyUI's own web server (/resolution_presets/list, /add, /delete), and presets land in presets.json next to the node. That's why there are no third-party Python dependencies - no requirements.txt, no models, nothing to fight with.

    The inputs and outputs that matter

    There's exactly one input, preset, and it's a dropdown rather than something you type. On a fresh install with no presets yet it reads "(no presets - add one below)".

    • Add new preset reveals Name/Width/Height fields and a Save button. Width and height step in multiples of 8, capped at 16384 - which lines up neatly with how people actually pick SDXL and Flux sizes, since the VAE wants multiples of 8 anyway.
    • Delete selected preset makes you click twice to confirm. Annoying for the first two seconds, then you're glad it's there.
    • The README promises rename too, but the shipped code only has add and delete - a small doc drift, not worth losing sleep over.

    The outputs are width (INT) and height (INT). Wire them into EmptyLatentImage (right-click its widgets → Convert widget to input first), or into any INT input that wants a size: an ImageScale target, a latent upscale, a crop. The node doesn't care - it just hands numbers downstream.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/raduchits/comfyui-raduchits-nodes.git
    

    Restart ComfyUI, right-click the canvas, and search for (R) Resolution Switcher. Or skip the terminal and use ComfyUI Manager - search "comfyui-raduchits-nodes". Either way, zero extra dependencies, and it's MIT licensed from a one-person pack.

    Where people get burned

    The one real trap: presets live in presets.json on your machine, not inside the workflow. Share a workflow that references "SDXL Portrait" and the recipient's node throws - the actual error text is "Resolution preset 'SDXL Portrait' not found. Add one with the button on the node." The same thing happens after a clean reinstall if you didn't back the file up, which is why the README tells you to. Honestly, this makes it a personal-convenience node more than a shareable one; if you need sizes that travel with the workflow, plain EmptyLatentImage widgets are the honest answer.

    Second, the dropdown is a frontend decoration. If you loaded ComfyUI in a browser tab before cloning the pack, the page's JS can be stale and you'll see a bare text field where the dropdown should be - type the preset name exactly or it throws the same "not found" error. Hard-refresh and it's back to a dropdown.

    It's a small tool, and a good one. If you flip between resolutions all day it quietly removes a real annoyance; if you generate at one size, you genuinely don't need it.

    CategoryRaduchits

    Inputs (1)

    NameTypeDefaultDescription
    presetSTRING

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT