Nodes/ComfyUI_Selectors/Width & Height
ComfyUI Node

Width & Height

The dimension node you'll actually reach for

By ComfyAssets·Created about a year ago·Updated about a year ago· 9
Width & Height
    • width
    • height
    width1024
    height1024
    presetcustom
    swap_dimensionsfalse

    Of the three dimension nodes in ComfyUI_Selectors, this is the one that earns its place. Width & Height gives you width, height, preset aspect ratios, and a portrait/landscape swap - all in a single box with two INT outputs. It's the cleanest answer to the question every reused workflow eventually asks: how do I resize the whole graph without opening four different nodes?

    The pitch is the same centralization as the rest of the pack, but here it actually pays off. Wire the width and height outputs into your EmptyLatentImage (convert the widgets to inputs first), and every other node in the graph that needs dimensions can hang off the same two outputs. Change one preset and your latent, your upscale target, and your comparison branches all move together. That's the difference between a workflow you babysit and a workflow that just works.

    How it works

    Four inputs, and the ordering matters:

    • width (default 1024) and height (default 1024) - both min 64, step 8, and the step of 8 is the safety net, because latent dimensions that aren't multiples of 8 fail at VAE decode. The node simply won't let you type a bad value.
    • preset (default custom) - nine aspect ratios: 1024x1024, 1152x896, 896x1152, 1216x832, 832x1216, 1344x768, 768x1344, 1536x640, 640x1536. These are the standard SDXL/FLUX sizes, with each portrait version paired with its landscape flip.
    • swap_dimensions (default off) - flips width and height.

    Pick a preset and it overrides the typed width and height. Leave custom and it passes your numbers through.

    The swap is where the UI gets clever. In the interface, swap_dimensions appears as a button rather than a checkbox - the pack ships a small JavaScript extension that hides the checkbox widget and gives you a one-click flip. Pick 1152x896 landscape, hit swap, and it becomes 896x1152 portrait. If you connect swap_dimensions as an input from elsewhere in the graph, the flip becomes something you can drive programmatically instead of by hand. Either way it's the fastest way to test a portrait version of a shot without touching the numbers.

    Wiring it

    Both outputs are plain INTs, which makes them friendly: convert width on your EmptyLatentImage to an input, connect the width output; convert height, connect the other. Because they're plain integers you can also feed them into arithmetic or any node that takes an INT - batch toggles, aspect-ratio math, that kind of thing. That's a real advantage over the preset-only dimension nodes that lock their output to their own types.

    Install

    Via ComfyUI Manager, search "ComfyUI_Selectors" and install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ComfyAssets/ComfyUI_Selectors.git
    

    Restart ComfyUI fully afterward. No models, no runtime pip dependencies - requirements-dev.txt is dev-only tooling, so install is genuinely clone-and-go. The node lands under comfyassets/Dimensions.

    One honest caveat: the pack's separate WidthNode and HeightNode exist for edge cases where you want only one dimension exposed. If you need both - the normal case - use this node and ignore those two. Also, if you load a shared workflow that expects the swap checkbox to be visible and it's not, that's this pack's extension hiding it, not a missing widget - the button is doing the same job.

    Categorycomfyassets/Dimensions

    Inputs (4)

    NameTypeDefaultDescription
    widthINT102464–16384Image width in pixels (must be multiple of 8)
    heightINT102464–16384Image height in pixels (must be multiple of 8)
    presetCOMBOcustomSDXL/FLUX resolution presets
    swap_dimensionsBOOLEANfalseSwap width and height values

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT