Qwen Official Qwen Training Aspect Ratio Buckets (16:9 vs 4:3 vs 1:1 vs original input)
A precision canvas and latent generator designed specifically for Qwen Image Edit workflows. It ensures your inputs perfectly align with the high-performance training buckets used by Alibaba's Qwen team.
Most models are sensitive to input resolutions. Using standard 512x512 or 1024x1024 latents often results in "composition drift" or "hallucinations" because the model was never trained on those shapes.
This node acts as a Hardware-Software Bridge:
- Official Training Buckets: Automatically snaps to the exact resolutions Qwen was trained on (up to ~1.7M pixels).
- Visual Proxy: Real-time dashed-line feedback on the node itself to show the target aspect ratio before you even press "Queue".
- Smart Fitting: Intelligently fits your reference images into the "Golden Standard" frames using three professional scaling strategies.
The node enforces the specific resolutions used in Qwen's final training stage to maximize inference quality:
| Aspect Ratio | Target Resolution | Total Pixels |
|---|---|---|
| 1:1 (Square) | ~1.76 M | |
| 4:3 (SD) | ~1.62 M | |
| 3:4 (Portrait) | ~1.62 M | |
| 3:2 (Full Frame) | ~1.67 M | |
| 2:3 (Sketch) | ~1.67 M | |
| 16:9 (Widescreen) | ~1.54 M | |
| 9:16 (Vertical) | ~1.54 M |
When providing an input image, choose how it adapts to the Qwen canvas:
- Crop: Fills the canvas and cuts off edges (Best for maintaining subject scale).
- Pad: Fits the whole image inside the canvas with black bars (Best for keeping the whole composition).
- Stretch: Forces the image to match the ratio (Best for precise pixel alignment).
The node's UI dynamically updates:
- Dashed Outline: Shows the aspect ratio visually on the node body.
- Live Preview: If
vae_encodeis enabled, a low-res thumbnail of the processed result appears directly on the node for instant verification.
- Purpose: A fast, lightweight "Empty Latent" generator.
- Usage: Select your ratio and link it to your sampler.
- Purpose: The ultimate image-to-image / editing pre-processor.
- Inputs: Accepts optional
pixelsandVAE. - Modes:
- Original (Follow Input): Automatically calculates the best "1K-limited" resolution based on your input's unique shape, while remaining VAE-compatible (multiples of 8).
- ComfyUI Manager: Search for
ComfyUI-Qwen-Canvasand click Install. - Manual:
cd ComfyUI/custom_nodes git clone [https://github.com/liewcc/ComfyUI-Qwen-Canvas.git](https://github.com/liewcc/ComfyUI-Qwen-Canvas.git)
When using Qwen Image Edit workflows, always use the Plus node with scaling_strategy set to Pad. This ensures the model sees your entire original image within its optimal "vision window," preventing the loss of important details at the edges.
Best for Text-to-Image generation where you need a specific Qwen-optimized empty frame.
- LATENT Output Connect to KSampler (samples input).
- width/height Output Connect to any resolution-aware nodes or use as a reference for conditioning.
Best for Image Editing or Inpainting workflows where you have a reference image.
Use this when you want to "force" your input image into a Qwen-standard training bucket.
- pixels Input: Connect your Load Image node here.
- vae Input: Connect your VAE (from your Checkpoint Loader).
- vae_encode: Set to "Enabled".
- LATENT Output: Connect to KSampler's
latent_image. - PREVIEW_IMAGE Output: Use this for a Preview Image node to see how the node cropped/padded your original photo.
Use this when you don't need to encode the image yet, but want the Latent space to match your input's aspect ratio.
- pixels Input: Connect your Load Image node.
- aspect_ratio: Set to "Original (Follow Input)".
- vae_encode: Set to "Disabled".
- The node will now output an empty latent that perfectly matches the aspect ratio of your input image (downscaled to ~1M pixels).
-
1K Resolution Limit: The "Plus" node automatically applies a 1-Megapixel limit (approx. total area) to follow Qwen's vision encoder constraints, while ensuring dimensions are multiples of 8 for VAE compatibility.
-
Visual Feedback:
-
Dashed Box: Represents the target aspect ratio you selected.
-
Solid Image: Appears inside the node only when
vae_encodeis "Enabled" and an image is processed. -
Execution Signal: The Plus node is marked as an
OUTPUT_NODE, meaning it will update the UI even if its outputs aren't connected to a "Save Image" node.