Nodes/comfyui-AGSoft/AGSoft Empty Latent QwenImage
ComfyUI Node

AGSoft Empty Latent QwenImage

The 112 rule, automated — QwenImage latents that just work

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
AGSoft Empty Latent QwenImage
    • latent
    • width_px
    • height_px
    • width_latent
    • height_latent
    size_mode
    presetSquare - 1024x1024 (1:1)
    width1024
    height1024
    megapixels1.0
    aspect_ratio
    divisibility64
    batch_size1

    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.

    CategoryAGSoft/nodes

    Inputs (8)

    NameTypeDefaultDescription
    size_modeCOMBOChoose 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: Задать разрешение в мегапикселях
    presetCOMBOSquare - 1024x1024 (1:1)Select a predefined resolution and aspect ratio. Выберите предустановленное разрешение и соотношение сторон.
    widthINT10248–4096Width in pixels (must be divisible by 8). Ширина в пикселях (должна быть кратна 8).
    heightINT10248–4096Height in pixels (must be divisible by 8). Высота в пикселях (должна быть кратна 8).
    megapixelsFLOAT1.00.1–10Target resolution in megapixels (e.g., 1.0 = 1,000,000 pixels). Целевое разрешение в мегапикселях (например, 1.0 = 1 000 000 пикселей).
    aspect_ratioCOMBOTarget aspect ratio for the megapixel-based resolution. Целевое соотношение сторон для разрешения, заданного в мегапикселях.
    divisibilityCOMBO64Ensure the final width and height are divisible by this value. Гарантирует, что итоговые ширина и высота кратны этому числу.
    batch_sizeINT11–64Number of latent images to generate. Количество латентных изображений для генерации.

    Outputs (5)

    NameTypeDescription
    latentLATENT
    width_pxINT
    height_pxINT
    width_latentINT
    height_latentINT