AGSoft Empty Latent QwenImage
The 112 rule, automated — QwenImage latents that just work
- latent
- width_px
- height_px
- width_latent
- height_latent
QwenImage is picky about resolution in a way that catches people by surprise: its VAE works in 112-pixel blocks, so your dimensions need to be multiples of 112. 1008×1008, 1344×1008, 1792×1008 - those are the sweet spots. Set a "normal" size like 1024×1024 and you get a sampler error that doesn't obviously point at your latent node. AGSoft Empty Latent QwenImage bakes that rule in, so the multiples-of-112 problem never reaches you.
It's the Qwen-flavored member of the pack's Empty Latent family, and it's the one with the strictest geometry - which is exactly why it's the most valuable of the four.
How it works
The node builds a 4-channel empty latent whose pixel dimensions are forced to be multiples of 112. size_mode offers the usual trio:
- Preset - a Qwen-specific menu. The square default is
Square - 1008x1008 (1:1)(note: not 1024 - 1024 isn't a multiple of 112), with Qwen-appropriate squares, portraits, and landscapes throughout, like 1120×1120, 1344×1008, 1792×1008 (16:9), 1120×1792, 2240×1120. - Custom - raw
width/height, min 112, stepping by 112. - Megapixels -
megapixels+aspect_ratio, rounded to the 112 grid so the result stays valid for the VAE.
There's no separate divisibility input here because there's nothing to choose: 112 is the law, and the node enforces it. batch_size sets how many latents you get.
Outputs mirror the other Empty Latents: latent, width_px/height_px, and width_latent/height_latent. If you're wiring a resolution label into your workflow, those ints come in handy, and they're guaranteed 112-compatible.
Where it sits in a Qwen pipeline
In a Qwen-Image or Qwen-Edit workflow this replaces the generic Empty Latent entirely: pick a preset, feed latent into your sampler's latent_image, done. The preset menu is also a nice cheat sheet for which resolutions Qwen actually supports - worth keeping open even if you'd normally type sizes by hand.
Installing it
Pack standard: ComfyUI Manager → search comfyui-AGSoft → install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
No models to fetch, no dependencies beyond PyTorch - it's a pure geometry node.
Common issues
The failure you'll actually hit isn't this node; it's Qwen-Image-Edit being subtly misaligned even at legal resolutions, which the community has documented across edit workflows (the workaround there is crop-and-stitch inpainting, not a bigger latent). Within this node's own scope, the only real trap is grabbing a preset from the generic AGSoft Empty Latent out of habit - 1024×1024 there is not 1024×1024 here, and the sampler will tell you loudly. Keep the model and the latent node in the same family and you're fine.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| size_mode | COMBO | Choose how to define the image size: - Preset: Use predefined sizes (Square/Portrait/Landscape) - Custom: Manually enter width and height - Megapixels: Specify target resolution in megapixels Выберите способ задания размера изображения: - Preset: Использовать предустановленные размеры - Custom: Вручную указать ширину и высоту - Megapixels: Задать разрешение в мегапикселях | |
| preset | COMBO | Square - 1024x1024 (1:1) | Select a predefined resolution and aspect ratio. Выберите предустановленное разрешение и соотношение сторон. |
| width | INT | 10248–4096 | Width in pixels (must be divisible by 8). Ширина в пикселях (должна быть кратна 8). |
| height | INT | 10248–4096 | Height in pixels (must be divisible by 8). Высота в пикселях (должна быть кратна 8). |
| megapixels | FLOAT | 1.00.1–10 | Target resolution in megapixels (e.g., 1.0 = 1,000,000 pixels). Целевое разрешение в мегапикселях (например, 1.0 = 1 000 000 пикселей). |
| aspect_ratio | COMBO | Target aspect ratio for the megapixel-based resolution. Целевое соотношение сторон для разрешения, заданного в мегапикселях. | |
| divisibility | COMBO | 64 | Ensure the final width and height are divisible by this value. Гарантирует, что итоговые ширина и высота кратны этому числу. |
| batch_size | INT | 11–64 | Number of latent images to generate. Количество латентных изображений для генерации. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width_px | INT | — |
| height_px | INT | — |
| width_latent | INT | — |
| height_latent | INT | — |