Nodes/Candlehead-Comfy-Nodez/QWEN Aspect Ratio to Resolution
ComfyUI Node

QWEN Aspect Ratio to Resolution

Stop guessing Qwen's resolution buckets — this node holds the table

By Candlehead·Created 7 months ago·Updated 7 months ago· 0
QWEN Aspect Ratio to Resolution
    • width
    • height
    • info
    aspect_ratio16:9

    If you've loaded a Qwen-Image or Qwen2.5-VL workflow and seen people insist on generating at exactly 1328×1328, or 1664×928, or 1472×1140 - you've hit Alibaba's fixed list of "smart resolution" buckets. Those numbers aren't random, they're not multiples of 64 you can eyeball, and copy-pasting them out of a Reddit comment is exactly how they get mangled. AspectToRes just holds the table and hands you clean INTs.

    What it is

    AspectToRes (shown in the node menu as "QWEN Aspect Ratio to Resolution") takes an aspect ratio string like 16:9 and returns the matching width and height from a hardcoded lookup table:

    | Ratio | Resolution | |---|---| | 1:1 | 1328×1328 | | 16:9 | 1664×928 | | 9:16 | 928×1664 | | 4:3 | 1472×1140 | | 3:4 | 1140×1472 | | 3:2 | 1584×1056 | | 2:3 | 1056×1584 |

    That's it. No API, no model, no math, no image input. It's a dictionary with a widget on it.

    How it works

    The whole node is one line: aspect_map.get(aspect_ratio.strip(), (1328, 1328)). You type a ratio, it looks it up, and anything not on the list silently falls back to the 1328×1328 default. There is no arithmetic - it will not compute 21:9 for you. Feed it 21:9 and you get square output with zero warning. That silent fallback is the one trap worth remembering.

    The inputs and outputs that matter

    One input:

    • aspect_ratio - a plain text field, default 16:9. Type it like 4:3 or 16:9; it strips whitespace, so 16:9 works too.

    Three outputs:

    • width and height (both INT) - wire these into anything that takes a resolution: an Empty Latent Image, Qwen-Image's native generation nodes, or ImageScaleToTotalPixels. For Qwen-Image-Edit in particular, controlling the input size genuinely matters - it returns a whole new image rather than patching yours, and the community found input resolution is exactly where geometric drift creeps in.
    • info (STRING) - a human-readable Input: 16:9 | Output: 1664×928 line you can drop into a text widget or a log node.

    When you'd actually reach for it

    Any workflow where the model is Qwen-family and you want to flip between aspect ratios without typing the bucket numbers every time. The Qwen-Image comparison posts on Reddit standardize on 1328×1328 precisely because it's the native bucket; this node stops you from feeding Flux-shaped sizes into a Qwen pipeline and wondering why the composition falls apart.

    Installing it

    This node ships in the Candlehead-Comfy-Nodez pack, which has no dependencies at all - no requirements.txt, no model downloads, pure Python stdlib. Install once, get all four nodes in the pack:

    ComfyUI Manager → Custom Nodes → search "Candlehead" → install → restart.

    Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Candlehead/Candlehead-Comfy-Nodez
    

    Restart ComfyUI, then search the node menu for "QWEN Aspect Ratio to Resolution" - that's the display name; the class under the hood is AspectToRes.

    Gotchas

    • Unsupported ratios fall back to 1328×1328 silently. If output suddenly looks square, check the info string to see what actually matched.
    • The README is lying (gently). It lists an "Image input pipe" input, but the shipped code has no such thing - the only input is the aspect_ratio string. Don't hunt for an image input that isn't there.
    • It's fixed buckets, not a calculator. Need a one-off custom size? Type the numbers into a primitive and skip the node entirely.
    Categoryimage/resolution

    Inputs (1)

    NameTypeDefaultDescription
    aspect_ratioSTRING16:9

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    infoSTRING