Nodes/ComfyUI-Visionatrix/Aspect Ratio (VixUI)
ComfyUI Node

Aspect Ratio (VixUI)

Pick '3:4' and get width, height and the ratio string, all at once

By Visionatrix·Created 2 years ago·Updated about a year ago· 3
Aspect Ratio (VixUI)
    • ratio
    • width
    • height
    aspect_ratio
    display_nameAspect Ratio
    optionaltrue
    advancedtrue
    order20
    custom_idaspect_ratio
    hiddenfalse

    VixUiAspectRatioSelector is the cleanest example of what the whole VixUI family is about. It's a dropdown of fourteen common image aspect ratios - 1:1 (1024x1024), 2:3 (832x1216), 16:9 (1344x768), all the way to 21:9 (1536x640) - and it hands you three outputs in one go: the ratio string, the width and the height. Wire width and height into an EmptyLatentImage (or EmptySD3LatentImage for Flux) and your generation size follows the dropdown. That's the whole workflow.

    In the Visionatrix context it doubles as a UI control - a Visionatrix user picks "3:4 portrait" from a dropdown instead of you hardcoding a latent size. But unlike most of the VixUI nodes, this one earns its keep even in plain ComfyUI, because it replaces the fiddly two-number job of typing a width and a height whenever you change aspect ratio.

    Inputs

    • aspect_ratio - the dropdown. Fourteen presets covering landscape, portrait and square, all sized for common SDXL/Flux latent dimensions (multiples of 64, so no rounding surprises).
    • display_name (default "Aspect Ratio"), optional, advanced, order (default 20), custom_id (default "aspect_ratio") - the usual VixUI control metadata. In plain ComfyUI only the dropdown matters.

    hidden is the only optional input.

    Outputs

    • ratio (STRING) - e.g. "3:4". Handy if a downstream node wants the ratio as text for conditioning or naming.
    • width (INT) and height (INT) - the pixel dimensions. width and height go into an EmptyLatentImage / EmptySD3LatentImage node, and the ratio string can feed a Show Text or a filename token.

    How it works

    The dropdown entries are literally stored as "3:4 (1152x896)" strings; the node splits on the parenthesis, parses the two numbers, and returns all three. Zero computation, zero chance of a mismatch between the label and the numbers - the source is one short method.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Visionatrix/ComfyUI-Visionatrix
    

    Restart ComfyUI, or install ComfyUI-Visionatrix via ComfyUI Manager. No model downloads; only the standard torch/pillow/numpy deps, all pre-installed.

    Where it falls short

    The honest limitation: the presets are fixed, and they're SDXL/Flux-shaped. If you work at unusual resolutions or a model wants exact native sizes (some video models do), you'll still reach for a manual EmptyLatentImage. And the list is portrait-first - 1:1, 2:3, 3:4, 5:8, 9:16, 9:19, 9:21 - then landscape mirrored after. Fine for most work, mildly annoying if your default is ultrawide. But for the common case of "let the user pick the shape," it's the node I'd grab, because one dropdown replacing two number fields is the exact right trade.

    CategoryVisionatrix/UI

    Inputs (7)

    NameTypeDefaultDescription
    aspect_ratioCOMBO14 options: 1:1 (1024x1024), 2:3 (832x1216), 3:4 (896x1152), 5:8 (768x1216), 9:16 (768x1344), 9:19 (704x1472), +8
    display_nameSTRINGAspect Ratio
    optionalBOOLEANtrue
    advancedBOOLEANtrue
    orderINT20
    custom_idSTRINGaspect_ratio
    hiddenoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    ratioSTRING
    widthINT
    heightINT