Nodes/ComfyUI-Qwen-Canvas/๐Ÿ–ผ๏ธ Qwen Canvas (Basic)
ComfyUI Node

๐Ÿ–ผ๏ธ Qwen Canvas (Basic)

Feeding Qwen-Image-Edit random resolutions is why your edits drift

By liewccยทCreated 7 months agoยทUpdated 7 months agoยท 2
๐Ÿ–ผ๏ธ Qwen Canvas (Basic)
    • LATENT
    • width
    • height
    โ—„aspect_ratio1:1 (1328 x 1328)โ–บ
    โ—„batch_size1โ–บ

    Qwen-Image-Edit is the open instruction editor most of the community runs now - give it a picture and a sentence, and the change happens. But it has one famous footgun. It re-emits the whole frame on every edit, and when the input resolution doesn't line up with what it was trained on, the whole image comes back geometrically offset. Proportions skew, things shift, characters look like a funhouse mirror. The community's fix, repeated in the "solve the offset problem" threads, is boring and effective: control the input size. That's the entire job of this node. It's an empty latent generator that snaps the frame to the exact aspect-ratio buckets Alibaba's Qwen team trained on, so you never hand the sampler a resolution the model doesn't recognize.

    What it is: a specialized Empty Latent. You pick one of seven preset aspect ratios, it hands back a blank latent at that exact size for your sampler to denoise. No image, no VAE, no model download, no API key - the name oversells it slightly; it's a smarter resolution dropdown.

    The buckets it enforces:

    • 1:1 โ†’ 1328 x 1328
    • 16:9 โ†’ 1664 x 928
    • 9:16 โ†’ 928 x 1664
    • 4:3 โ†’ 1472 x 1104
    • 3:4 โ†’ 1104 x 1472
    • 3:2 โ†’ 1584 x 1056
    • 2:3 โ†’ 1056 x 1584

    Notice they're all around 1.5โ€“1.8 megapixels and every dimension is a multiple of 8 - VAE-compatible, so the latent encodes cleanly. That's the point. A core Empty Latent defaults to 1024x1024, which is an SDXL-era shape and close to no trained Qwen bucket at all.

    How it works: the node parses the resolution out of the enum string you picked and builds torch.zeros([batch_size, 4, height // 8, width // 8]). That // 8 is the VAE's 8x downsampling - a 1664x928 canvas becomes a 208x116 latent. The width and height it outputs are the pixel dimensions, so any resolution-aware node downstream can read them without you doing arithmetic.

    The inputs that matter (that's honestly all of them):

    • aspect_ratio - the seven buckets above. Pick the closest shape to what you want.
    • batch_size - 1 to 64. You'll hit VRAM long before 64 on a 20B model, so treat the upper range as decoration.

    Outputs: LATENT wires into your sampler's latent_image. width and height feed anything resolution-aware, or just serve as on-graph documentation.

    Install - no dependencies beyond what ComfyUI already ships (torch, numpy, Pillow):

    cd ComfyUI/custom_nodes
    git clone https://github.com/liewcc/ComfyUI-Qwen-Canvas
    

    Then restart ComfyUI. Or open ComfyUI Manager, search ComfyUI-Qwen-Canvas, and hit Install - same result.

    Where it fits: the obvious slot is text-to-image on the Qwen-Image base or a Qwen-Edit workflow that's generating from nothing, where a template's baked-in 1024x1024 latent is quietly giving you drift you've been blaming on the prompt. Swap this in and the geometry stops fighting you.

    Two honest warnings. Don't use it with non-Qwen models - SDXL's trained ratios are a different list, and this node's whole reason to exist is matching Qwen's training distribution. And if you have a reference image you want to edit, you want the Plus node from this same pack, which takes the image and fits it; Basic only makes blank frames.

    It's a tiny node and you could type 1664 x 928 into a core Empty Latent. What it buys you is not memorizing seven magic resolutions and not fat-fingering a 7 into the wrong box at 2am. That's a legitimate purchase.

    CategoryQwen Toolset

    Inputs (2)

    NameTypeDefaultDescription
    aspect_ratioCOMBO1:1 (1328 x 1328)7 options: 1:1 (1328 x 1328), 16:9 (1664 x 928), 9:16 (928 x 1664), 4:3 (1472 x 1104), 3:4 (1104 x 1472), 3:2 (1584 x 1056), +1
    batch_sizeINT11โ€“64โ€”

    Outputs (3)

    NameTypeDescription
    LATENTLATENTโ€”
    widthINTโ€”
    heightINTโ€”