Text Encode Qwen Image 2.1
Prompts, reference images, and the latent that has to match
- clip
- vae
- image_1
- images
- positive
- negative
- latent
Qwen Image's Edit line became the default open instruction-editing stack for one blunt reason: Apache 2.0, no NSFW policing, no takedown risk for fine-tunes. Its encoder node is also unusual in ComfyUI, because it wants to hand you three things at once - positive conditioning, negative conditioning, and a latent sized to your reference images.
What it is
A wrapper around ComfyUI's native TextEncodeQwenImage21. It's not reimplementing the encoder; it's giving you the awkward plumbing in one node. Connect clip, vae, both prompts, optionally some reference images, and out come positive, negative and latent.
That latent is the point. For Qwen Image 2.1 editing work, the sampler's target latent has to match the size of your references, and computing that yourself is fiddly. This node builds it for you, following the first reference image's resized dimensions. Without references it's square at the selected resolution, and a resolution of 0 falls back to 1024.
The inputs
clip and vae are required, then positive and negative - both STRING sockets, no widgets. An empty string is perfectly valid, which is convenient because an empty negative is normal here. The resolution field (default 1024, step 32) resizes each reference to about resolution² pixels while preserving aspect ratio, rounding dimensions to multiples of 32. Zero keeps each reference's own size, rounded to 32.
image_1, image_2, … up to image_16 - ComfyUI's native V3 autogrow sockets, no Eclipse required. They appear as you connect them, in numeric order, and the first image of each input batch is what gets used. Upstream encoding keeps RGBA for the VAE and composites alpha over white for the vision encoder, which is the behaviour you want and would never guess.
Outputs: positive, negative, latent, all forwarded from upstream. Feed the latent to the sampler so its dimensions agree with your references.
The pairing rules that actually break runs
Get these wrong and you'll spend an evening blaming the sampler:
- The CLIP type is
qwen_image, notqwen_image_2.1. ComfyUI picks the 2.1 encoder off the weight architecture. Use Qwen3-VL-8B weights. Older Qwen Image encoders are not interchangeable. - The VAE must be the Qwen Image 2.1 one. Either the native
qwen_image_2.1_vae_bf16.safetensorsor a recognized Diffusers-format file. The original Qwen Image VAE is not interchangeable - and sampling can complete happily with a mismatched VAE before failing at decode. - You need a ComfyUI version that provides
TextEncodeQwenImage21. On older installs the node still registers and then fails at execution. Read the error as "update ComfyUI", not "the pack is broken".
Installing it
ComfyUI Manager → search Smart Model Loader Nova, or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_SmartModelLoader_Nova.git
cd ComfyUI_SmartModelLoader_Nova
python -m pip install -r requirements.txt
ComfyUI's Python environment, restart, then Add Node → 🌒 Smart Model Loader Nova → Conditioning. No extra dependencies for this node - the encoder is ComfyUI's.
Where people get burned
Wiring the wrong latent. Use this node's latent output for editing. If you feed an SDXL-shaped or hand-built latent, the model wants 64 channels and one token per latent spatial position, and it won't politely adapt.
Resolution 0 surprises. Zero means "keep each reference's own size", not "use the default". If your output size changes when you tick 0, that's why. Without any references, zero falls back to 1024 square.
Expecting 16 image sockets to seem sensible. They're autogrow - the second one only appears when you connect the first, and trailing empties disappear when you disconnect. If your node looks stuck at image_1, that's the intended shape.
Treating the prompt sockets as widgets. Same as CLIP Text Encode [SML2]: both prompts require a string source upstream. Right-click and add a PrimitiveString, or use a prompt concat node.
Assuming "open" means unrestricted. The Qwen family is Apache 2.0 and genuinely free of Kontext-style policing, but how much explicit content the base model renders unaided is undocumented. Being permissive about takedowns isn't the same as being trained for it.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| vae | VAE | — | |
| positive | STRING | — | |
| negative | STRING | — | |
| resolution | INT | 10240–4096 | Resize references to about resolution squared pixels, preserving aspect ratio at multiples of 32. 0 keeps their own size, rounded to multiples of 32. |
| image_1opt | IMAGE | — | |
| imagesopt | COMFY_AUTOGROW_V3 | Optional references in socket order; use the first image of each input batch. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |