Nodes/ComfyUI 1hewNodes/String Ratio Qwen Image 3.0 Pro
ComfyUI Node

String Ratio Qwen Image 3.0 Pro

Qwen Image 3.0 Pro Takes 15 Ratios — Let the Image Pick Yours

By 1hew·Created about a year ago·Updated 17 days ago· 35
String Ratio Qwen Image 3.0 Pro
  • image
  • string
◄selection1:1►

Qwen's cloud image endpoint doesn't want a width and a height. It wants an aspect-ratio string from a menu of fifteen - from a squat 3:1 all the way to a phone-tall 1:3 - and guessing wrong gets you a reshaped image. This node reads your image and picks the entry for you.

What it is, and when you'd want it

String Ratio Qwen Image 3.0 Pro outputs the nearest supported aspect ratio for each image you give it, as a plain string. Fifteen options: 3:1, 21:9, 2:1, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16, 1:2, 9:21, 1:3. No resizing, no generation, no network call, no API key.

The context here is the Qwen-Image family, which won the open editing fight with its Apache 2.0 Edit line and then pushed its newest generation out API-only. So a lot of Qwen work now has a cloud hop in it: a small node pack, 1hewOffice (a separate install by the same author), wraps the Qwen Image 3.0 Pro endpoint, and that node's aspect_ratio input is exactly what this output feeds. If you're running local Qwen weights, you don't need this node - you're setting pixels directly.

How the matching works

Pure arithmetic, and it's the interesting part. For each frame the node takes width / height, then walks the fifteen presets comparing |log(image_ratio) - log(preset_ratio)|, keeping the smallest. Log space means it picks the nearest ratio by relative error, so a 2:1 image stays 2:1 rather than collapsing to 16:9 - the distortion you'd feel is proportional, and that's what's being minimised.

Practical consequences:

  • 5:4 survives here. A 1280x1024 reference comes back 5:4, because this menu actually has it. On the Doubao selector, the same image would land on 4:3.
  • 2:1 survives here too, alongside 3:1 and 1:2, 1:3, 9:21.
  • Extremes snap inward. Qwen officially supports roughly 1:8 to 8:1, so a 10:1 panorama collapses to the nearest entry on the list, not to something outside it.

Batch input is matched per frame, with results joined by newlines - one line per image.

Inputs and output

selection is the COMBO, default 1:1, and it's the manual fallback. Leave image unconnected and this node is just a string constant that emits your chosen ratio - handy for pinning a fixed shape, or as a source for logging and filenames. It's also the honest way to run text-to-image, where there's no image to infer from.

image is the optional IMAGE input that turns it into an inference node: connect a reference and the nearest of the fifteen comes out.

string is the output - a STRING for the API node's aspect_ratio, or anything else that takes text.

One caveat straight from the author's docs, and it's the kind of thing you'd never guess: on the API node's image-edit path, the size field is ignored upstream and the output follows the reference image's ratio at roughly 2K. So this node's ratio mainly changes the outcome on text-to-image runs. Don't spend an evening rewiring for an edit workflow and expect the ratio to move.

Installing it

Search 1hewNodes in ComfyUI Manager, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

The pack's requirements.txt drags in the whole vision stack - opencv-python, scikit-image, psd-tools, color-matcher, ultralytics, rembg, transparent-background, onnxruntime, av, torchaudio - none of which a string selector needs, but you get them with the pack. Node discovery walks every module under nodes/ and logs-and-skips any that fail to import, so a broken dependency shows up as a node quietly missing from the menu, not a crash. Restart after installing and search the node list by its display name.

Worth saying plainly if you're deciding whether to trust this pack: 1hewNodes has essentially no Reddit footprint. I searched the corpus for the pack and the companion 1hewOffice pack and got zero threads, both literal and loose. It's a one-author utility collection that accumulates changelog entries every few weeks, not a pack with a community following - so judge it on the source (which is tidy, typed, and self-documenting) rather than on word of mouth.

Where people get burned

The output is a label, not a size. The final pixel count comes from the API node's resolution tier (1k / 2k) combined with this ratio in the official size table. Pair this with String Resolution Qwen Image 3.0 Pro and you've described the image completely without generating anything yet.

Multi-image batches give you multiple lines. Fine for text plumbing, useless for a single aspect_ratio field.

auto and dynamic are deliberately absent. The API node infers those itself; this node exists to hand you a concrete string.

Old workflows may have a dead node. The pack retired its generic resolution selector in v3.28.0 in favour of per-model nodes. A missing-node error after upgrading is that, not a bad install.

Category1hewNodes/text

Inputs (2)

NameTypeDefaultDescription
selectionCOMBO1:115 options: 3:1, 21:9, 2:1, 16:9, 3:2, 4:3, +9
imageoptIMAGE—

Outputs (1)

NameTypeDescription
stringSTRING—