Nodes/ComfyUI 1hewNodes/Text Encode QwenImageEdit
ComfyUI Node

Text Encode QwenImageEdit

The Qwen image-edit conditioning encoder, minus the workflow surgery

By 1hew·Created about a year ago·Updated 7 days ago· 33
Text Encode QwenImageEdit
  • clip
  • vae
  • image_1
  • conditioning
prompt
reference_skip_prepfirst
reference_sq_area1024
vision_embedstretch

Qwen-Image-Edit is the open instruction editor that took over image editing in ComfyUI - you hand it a picture and a sentence ("change her dress to blue", "remove the watermark") and the model does the rest, no mask required. But to drive it from a node graph you need to build its conditioning the exact way the model expects: the image as vision tokens, the instruction as text, and often a VAE-encoded reference latent so the output actually holds onto the original appearance. That plumbing is what this node encapsulates.

What it does

Text Encode QwenImageEdit is the conditioning encoder for Qwen-Image-Edit workflows. It takes a CLIP (the Qwen-Image family's text encoder), your instruction in prompt, and one or more input images, and produces a CONDITIONING you feed straight into a sampler. It's the Qwen-edit equivalent of the standard CLIP Text Encode - one node where the official reference workflow used a tangle of them.

How it works

Internally it does three jobs. First, it prepares each input image for the vision encoder: images are downscaled toward the model's 384×384 vision window, and vision_embed picks the strategy - stretch (default), crop, pad, or area (aspect-preserving). Then it assembles the prompt in the model's expected chat format - a system line telling the model to describe the input then apply the instruction, the instruction text, and vision-token placeholders for each image - and tokenizes with the images attached so the CLIP embeds text and vision together.

Third, the optional vae input unlocks reference latents: if you connect a VAE, the input image is encoded into latent space and attached to the conditioning as reference_latents. That's the mechanism behind "edit but keep it looking like this." reference_skip_prep (none / first / all) controls which images get a direct, unaltered VAE encode - for an 8-aligned image it encodes straight through; anything else is downscaled to a target area set by reference_sq_area (default 1024, rounded to multiples of 8) first so the encode stays clean. With no VAE connected, you get pure instruction conditioning without the latent anchor.

The inputs that matter

  • clip (CLIP) - a Qwen-Image-Edit-capable text encoder.
  • prompt (STRING, multiline) - the instruction, plain language.
  • image_1 … image_N (IMAGE, optional) - the input(s) to edit (multi-image works with the 2509+ revisions).
  • vae (VAE, optional) - connect it to get reference latents.
  • reference_skip_prep / vision_embed / reference_sq_area - the knobs above.

Output: conditioning (CONDITIONING).

Installing it

ComfyUI Manager → search ComfyUI-1hewNodes → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Restart ComfyUI. This node itself needs no model download, but it's useless without the Qwen-Image-Edit weights - a 20B model, so realistically a GGUF quant - plus its text encoder. The pack's requirements include transformers and huggingface-hub, which the Qwen CLIP path relies on. Keep ComfyUI current; this node uses the newer comfy_api.latest API.

Common issues

The most common failure is wiring this to a non-Qwen CLIP - the node builds a Qwen-specific chat template, so a standard SDXL/Flux text encoder will produce garbage. Same for the VAE: it should be the Qwen Image VAE, not whatever your last checkpoint used. Watch image dimensions, too: non-8-aligned images get routed through the downscale path even in first/all modes, so don't be surprised that a 1025px input behaves differently from 1024. And remember the model's known quirk - it re-emits the whole frame, so drift is inherent; reference_skip_prep keeps the anchor but won't freeze unedited pixels. If you need pixel-exact preservation, mask the region and let the model only touch the crop instead.

Category1hewNodes/condition

Inputs (7)

NameTypeDefaultDescription
clipCLIP
promptSTRING
reference_skip_prepCOMBOfirst3 options: none, first, all
reference_sq_areaINT102464–8192
vision_embedCOMBOstretch4 options: crop, pad, stretch, area
vaeoptVAE
image_1optIMAGE

Outputs (1)

NameTypeDescription
conditioningCONDITIONING