Qwen Aspect Ratio Selector (Latent)
Qwen-friendly resolutions without the mental math
- latent
If you've ever stared at the built-in Empty Latent Image node trying to remember what resolution Qwen-Image actually wants, this is the node for you. It's a drop-in replacement for Empty Latent Image that bakes in Qwen-Image's official resolution ladder (the "native 1328px longest side" thing), plus two dozen named aspect ratios, and hands you a ready-to-use latent. One node, one output, no model downloads, no dependencies. It's a utility - and honestly, that's all it needs to be.
How it works
The math is the same as ComfyUI's own Empty Latent Image, just with the Qwen presets hardcoded in. You pick a mode, the node works out width and height, rounds them to a multiple of 8 (VAE compatibility), divides by 8, and builds a torch.zeros([batch_size, 4, h/8, w/8]) tensor wrapped as a LATENT. That output wires straight into any KSampler or whatever node expects a latent - exactly where Empty Latent Image would go.
The interesting part is the three modes, and here's the first trap: the author is French, and so is the dropdown. You'll see Recommandé, Ratio d'Aspect, and Manuel instead of English labels. They mean:
- Recommandé - pick from the 10 official Qwen-Image resolutions (
1328x1328,1664x928,928x1664,1472x1140, …). This is the mode most people want. Note512x512and768x768are in there for speed checks, not quality. - Ratio d'Aspect - choose one of the 23 ratios (1:1 up to 32:9) and set
target_size, the longest side. Defaults to 1328, which is Qwen-Image's native sweet spot. - Manuel - type your own
manual_width/manual_height. Handy, but you could do that with the built-in node; you're here for the presets.
batch_size (1–64) sets how many blank latents you get, same as Empty Latent Image. All three modes plus the ratio picker are in required inputs, so they always show.
The honest caveat
Here's what nobody tells you: Qwen-Image runs on a 16-channel latent, and this node outputs 4. The 4-channel zeros are exactly what the built-in Empty Latent Image produces - right for SD and SDXL, wrong for Qwen-Image's native sampler, whose VAE is z_dim: 16 (same VAE family as Wan). The resolutions are genuinely Qwen's own; the latent tensor is SD-flavored. If your Qwen sampler throws a shape mismatch, that's why. Practical fix: use this node for the dimensions, and feed its width/height into a 16-channel empty-latent node, or just use it with an SD-family model where it works out of the box.
Installation
Install it via ComfyUI Manager - search "Qwen Aspect Ratio" or paste the repo URL - or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/Verolelb/ComfyUI-Qwen-Aspect-Ratio
Then restart ComfyUI. That's the whole install: no requirements.txt, no weights to fetch, MIT licensed. One small README vs. reality note: the README tells you to copy a file called qwen_aspect_ratio_latent.py and find the node under a "Qwen Utils" category - neither matches the shipped code, which registers it as Qwen Aspect Ratio Selector (Latent) under Latent. Just search "Qwen" in the node menu and you'll find it.
Gotchas worth knowing
- The French mode dropdown confuses everyone once. Now you know.
- The ratio list calls 3:4 "Golden Ratio". It isn't - the golden ratio is ~1.618, not 0.75. It's just a flattering label; pick ratios by shape, not name.
- The README says 24 ratios; the code ships 23. Doesn't matter - the 1:1, 4:5, 16:9 and 21:9 options cover what anyone actually needs.
If this node saves you one trip to Google for Qwen-Image's resolution table, it's done its job. For a proper Qwen-Image setup, keep the 16-channel caveat in mind and you'll be fine.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 3 options: Recommandé, Ratio d'Aspect, Manuel | |
| batch_size | INT | 11–64 | — |
| recommended | COMBO | 10 options: 1328x1328, 1664x928, 928x1664, 1472x1140, 1140x1472, 1584x1056, +4 | |
| aspect_ratio | COMBO | 23 options: 1:1 (Perfect Square), 2:3 (Classic Portrait), 3:4 (Golden Ratio), 3:5 (Elegant Vertical), 4:5 (Artistic Frame), 5:7 (Balanced Portrait), +17 | |
| target_size | INT | 1328256–4096 | — |
| manual_width | INT | 102464–8192 | — |
| manual_height | INT | 102464–8192 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |