Qwen-Image in ComfyUI: Offset Fix and Setup
Qwen-Image setup in ComfyUI: model files, text encoder config, the image-offset problem solution, and comparison with FLUX and SDXL.
On this page
Qwen-Image in ComfyUI: Offset Fix and Setup
TL;DR
- Qwen-Image is a 20B MMDiT model with Qwen2.5-VL-7B text encoder for dual-encoding image editing [1][2][3]
- Offset problem fixed by scaling input to 1024px shortest side before VAE encoding [8]
- RES4LYF samplers provide 69 options with optimized 8-step RES_3S sampling [10]
- Qwen-Image outperforms FLUX/SDXL at complex Chinese/English text rendering [12][13]
Qwen-Image is a 20B-parameter MMDiT model for text-to-image and image-to-image generation. In ComfyUI, it requires three core model files — a UNET, a VAE, and a text encoder — plus the Qwen2.5-VL-7B tokenizer. The community has developed workflows that address a well-known image-offset problem through input scaling, while RES4LYF samplers provide optimized 8-step sampling for Qwen-Image's AuraFlow dynamics.
Model Files and Text Encoder Setup
Core Architecture Components
Qwen-Image is a 20B-parameter MMDiT foundation model [1]. The model requires three key files for ComfyUI setup [2]:
- UNET weights:
qwen_image_edit_fp8_e4m3fn.safetensors(FP8 E4M3FN quantized) - VAE weights:
qwen_image_vae.safetensors - Text encoder:
qwen_2.5_vl_7b_fp8_scaled.safetensorswith CLIP typeqwen_image
The text encoder loads Qwen2.5-VL-7B using QwenImageTokenizer and QwenImageTEModel from ComfyUI's core text encoder modules [3]. The tokenizer wraps Qwen2Tokenizer from HuggingFace transformers with a context length of 99999999 (effectively unlimited), distinguishing it from standard CLIP tokenizers [3]. It uses llama template systems with separate image and text templates, enabling Qwen-Image's bilingual (English/Chinese) text rendering during both text-to-image and image-to-image generation [3].
ComfyUI Node Configuration
The CLIPLoader node loads the text encoder with specific widget configurations [4]:
- Text encoder file:
qwen_2.5_vl_7b_fp8_scaled.safetensors - CLIP type setting:
qwen_image - Computation device:
cpu
The TextEncodeQwenImageEdit node is a custom node for the Qwen-Image-Edit pipeline that accepts three inputs — clip, vae, and image — enabling the dual-encoding mechanism where Qwen2.5-VL provides semantic control while the VAE encoder provides appearance control [5].
ComfyUI natively maps Qwen-Image to the Wan21 latent format with a sampling shift of 1.15, consistent across the QwenImage pipeline class [6].
The Image-Offset Problem and How to Fix It
Understanding the Problem
Qwen-Image-Edit generates output images where the composition is spatially misaligned relative to the input — character proportions are distorted and the overall picture is shifted [7]. The root cause within the model's denoising trajectory is not documented in the source material; the workflow mitigates the symptom through input standardization [7].
The Offset Fix Workflow
The offset fix workflow applies a multi-step solution using utility nodes [2][7]:
- Input Standardization: LayerUtility: ImageScaleByAspectRatio V2 resizes input images preserving aspect ratio using letterbox padding with black background (
#000000) and Lanczos resampling, scaling the shortest side to 1024 pixels [8]. This ensures the input to the VAE encoder has consistent dimensions before encoding.
- Latent Space Coherence: FluxKontextImageScale rescales the latent image representation to maintain spatial coherence in latent space during processing [8]. The node is connected to VAEEncode.pixels and is specific to the flux/kontext-style architecture.
- Visual Comparison: AILab_ImageStitch combines the processed input image (left) with the generated output (right) for side-by-side comparison [8]. The stitch mode is set to "right" with a white background (
#FFFFFF). A secondary Image Comparer node from rgthree provides an additional visual A/B comparison.
The core fix operates by scaling the input to a consistent dimension (1024px shortest side) before encoding, preventing the dimension-dependent misalignment that Qwen-Image-Edit exhibits at native resolutions [8]. The workflow contains 20 nodes total, including the offset-specific utility nodes and standard ComfyUI components [8].
Important Clarification on LoRA Usage
The offset fix article links to Civitai model 1934100 ("Anime2Real") as a LoRA for image generation [7]. However, this LoRA is a Flux.2 Klein LoRA for anime-to-realism style transfer — not a Qwen-Image LoRA. The actual offset-fix workflow uses Qwen-Image-Lightning-4steps-V1.0.safetensors and Temp\Anime to Realism-plus-1.0.safetensors, which are distinct from model 1934100 [8][9]. The inclusion of the model 1934100 link in the source article may indicate the author's other works or a shared workflow template, but its direct connection to Qwen-Image offset correction is not established.
RES4LYF Sampling for Qwen-Image
RES4LYF replaces the standard ComfyUI KSampler with ClownsharKSampler_Beta, providing 69 selectable samplers across ODE and SDE modes [10]. The sampler breakdown includes 44 explicit samplers, 18 fully implicit samplers, and 7 diagonally implicit samplers [10]. For Qwen-Image's AuraFlow rectified flow dynamics, the res_3s and res_2s samplers at 8 steps with the bong_tangent scheduler produce high-quality outputs [8][7].
The ModelSamplingAuraFlow node overrides the default shift from 1.15 to 1.98 in the hires workflow, expanding the sampling trajectory to capture fine details at higher resolutions [11]. RES4LYF documentation lists support for rectified flow models including SD3.5, AuraFlow, Flux, HiDream, and Chroma, so Qwen-Image compatibility is inferred from its use of AuraFlow rectified flow dynamics [10].
Qwen-Image vs FLUX and SDXL
Text Rendering Capabilities
Qwen-Image's primary differentiator is complex text rendering through progressive training from non-text to paragraph-level descriptions, with native support for both alphabetic (English) and logographic (Chinese) scripts [12]. FLUX and SDXL do not match Qwen-Image's text rendering fidelity for Chinese characters or for complex multi-region layouts [13].
FLUX models use a rectified flow architecture similar to Qwen-Image but employ separate CLIP-L and T5-XXL text encoders [14]. SDXL uses a UNet architecture with CLIP-L/OpenCLIP-G text encoders, which are structurally simpler and less capable for multilingual text rendering [13]. Neither FLUX nor SDXL includes a visual encoder comparable to Qwen2.5-VL for image conditioning during text generation.
Ecosystem Trade-offs
FLUX and SDXL have much larger community ecosystems, more extensive ComfyUI node support, and better documentation [13]. Qwen-Image-Edit's editing capabilities — semantic plus appearance dual control and precise bilingual text editing — are unique among these models but come at the cost of a smaller user base and fewer community workflows [5].
Architecture Comparison
| Model | Parameters | Architecture | Text Encoders |
|---|---|---|---|
| Qwen-Image | 20B | MMDiT | Qwen2.5-VL custom tokenizer |
| FLUX | 12B DiT | Rectified flow DiT | CLIP-L + T5-XXL |
| SDXL | ~3.5B UNet | UNet + VAE | CLIP-L + OpenCLIP-G |
FAQ
How do I set up the text encoder for Qwen-Image in ComfyUI? Use the CLIPLoader node with qwen_2.5_vl_7b_fp8_scaled.safetensors and set the CLIP type to qwen_image. This loads QwenImageTokenizer which uses the llama template system.
What causes the image offset problem in Qwen-Image-Edit and how do I fix it? The offset is a spatial misalignment where the output composition shifts relative to the input. The fix scales the input to a consistent 1024px shortest side using letterbox padding before VAE encoding, preventing dimension-dependent misalignment.
How does the AILab_ImageStitch node help with image offset in Qwen workflows? It provides side-by-side visual comparison of original versus generated outputs using a right-stitch layout with white background, allowing visual assessment of the offset correction.
What is the difference between KSampler and ClownsharKSampler_Beta for Qwen-Image? ClownsharKSampler_Beta offers 69 samplers including optimized RES_3S at 8 steps for AuraFlow dynamics, while standard KSampler lacks dedicated rectified flow optimization.
Can I use RES4LYF samplers with Qwen-Image-Edit or only Qwen-Image base? RES4LYF documentation supports rectified flow models broadly. Workflows use ModelSamplingAuraFlow which maps to AuraFlow sampling behavior, so compatibility is inferred but not explicitly confirmed in RES4LYF docs.
What is the QwenImageTokenizer and how does it differ from CLIPTokenizer? QwenImageTokenizer wraps Qwen2Tokenizer with llama prompt templates, provides context length of 99999999 (effectively unlimited), and handles both English and Chinese scripts natively — unlike CLIPTokenizer which is designed for the CLIP text encoder family.
What is the relationship between Qwen-Image and Flux in terms of architecture? Both use rectified flow dynamics, but Qwen-Image adds the Qwen2.5-VL visual encoder for dual-conditioning (semantic + appearance) and specialized progressive training for text rendering.
Common Errors and Fixes
| Symptom | Cause | Fix |
|---|---|---|
| Image offset / character proportion distortion | Spatial misalignment between input dimensions and model's expected latent grid | Scale input to shortest side 1024px with letterbox padding before encoding [8] |
| Poor text rendering | Incorrect CLIP model or data type | Use qwen_2.5_vl_7b_fp8_scaled.safetensors for CLIP and qwen_image_edit_fp8_e4m3fn.safetensors for UNET [4] |
| Slow generation | Standard KSampler lacks RES/rectified flow optimization | Replace KSampler with ClownsharKSampler_Beta, use res_3s at 8 steps [10] |
| Hires pass degrades composition | Spatial transform misalignment between base and hires passes | Apply FluxKontextImageScale in both passes for spatial coherence [8] |
| Numerical instability with high shift values | ModelSamplingAuraFlow shift exceeding stable range | Keep default shift 1.15 for Qwen-Image base; use 1.98 for hires with adequate denoise [11] |
Sources
| # | Source | URL |
|---|---|---|
| 1 | Qwen-Image 20B MMDiT foundation model (arXiv) | https://arxiv.org/abs/2508.02324 |
| 2 | Qwen/Qwen-Image HuggingFace model card | https://huggingface.co/Qwen/Qwen-Image |
| 3 | ComfyUI QwenImageTokenizer source (comfy/text_encoders/qwen_image.py) | https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/text_encoders/qwen_image.py |
| 4 | Qwen/Qwen-Image-Edit HuggingFace model card | https://huggingface.co/Qwen/Qwen-Image-Edit |
| 5 | Qwen-Image-Edit dual-encoding architecture | https://huggingface.co/Qwen/Qwen-Image-Edit |
| 6 | ComfyUI supported models (latent_formats.Wan21, shift 1.15) | https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/supported_models.py |
| 7 | Civitai article 19251: "Solve the image offset problem of Qwen-image-edit" (Sep 10, 2025) | https://civitai.com/articles/19251 |
| 8 | Offset fix workflow JSON (Qwen-Image-Edit.json attachment) | https://civitai.com/api/download/attachments/444964 |
| 9 | Civitai model 1934100 (Anime2Real, Flux.2 Klein LoRA) | https://civitai.com/models/1934100 |
| 10 | RES4LYF repository (69 samplers, 20 steps typical) | https://github.com/ClownsharkBatwing/RES4LYF |
| 11 | Hires workflow JSON (Qwen-Image-Hires-Custom.json attachment) | https://civitai.com/api/download/attachments/511437 |
| 12 | Qwen-Image progressive training curriculum | https://arxiv.org/abs/2508.02324 |
| 13 | Civitai article 22862: "Quickly sharing two versions of my Qwen-Image workflow" (Nov 24, 2025) | https://civitai.com/articles/22862 |
| 14 | FLUX architecture (DiT + CLIP-L + T5-XXL) | https://huggingface.co/docs/diffusers/main/en/api/pipelines/flux |
For additional ComfyUI setup examples, see Custom Node Guides. Advanced Sampling Techniques. Model Comparisons.