Nodes/AQnodes for ComfyUI/AQ_TextEncodeQwenImageEdit
ComfyUI Node

AQ_TextEncodeQwenImageEdit

The text-encode node for Qwen-Image-Edit style conditioning

By 2frames·Created about a year ago·Updated 6 months ago· 1
AQ_TextEncodeQwenImageEdit
  • clip
  • vae
  • image
  • CONDITIONING
prompt
use_imagetrue

This is essentially the ComfyUI core Qwen image-edit text encoder, re-shipped as an AQ node. If you're loading a Qwen-Image / Qwen-Image-Edit text encoder into the CLIP slot and want image-editing conditioning, this is the encoder that turns your prompt into something the sampler can use.

The important difference from a normal CLIP Text Encode: with an image-editing model, the "prompt" isn't just a string. It can reference the input image - "turn this into a watercolor, keep the subject" only means something if the text encoder actually sees the image. That's what this node handles: it passes the image into the tokenizer so the vision-language encoder gets both the text and the picture, and optionally encodes a reference latent through the VAE for the "preserve this image's character" path.

How it works

The mechanism is the same one the core node uses. If use_image is on and an image is connected, it scales the image so its pixel area stays around 1MP (1024x1024) - Qwen image-edit encoders have a fixed vision-token budget, so the node resizes to keep the token count constant regardless of input size. Then it calls clip.tokenize(prompt, images=...) and encodes via encode_from_tokens_scheduled. If you also connect a vae, it encodes the image into a reference_latent and stuffs it into the conditioning with the reference_latents key - that's what drives "keep the original image's identity" behavior in Qwen-Image-Edit.

Inputs

  • clip - the Qwen image-edit text encoder, from a CLIP loader.
  • prompt - your edit instruction, multiline.
  • use_image - boolean, default true. Turn it off to do pure text conditioning with this encoder.
  • vae (optional) - connect it if you want the reference-latent path.
  • image (optional) - the image the model should look at.

Output

CONDITIONING, which wires straight into the sampler like any other conditioning.

Install

Ships in AQnodes:

cd ComfyUI/custom_nodes
git clone https://github.com/2frames/ComfyUI-AQnodes
cd ComfyUI-AQnodes
pip install -r requirements.txt

or search "AQnodes" in ComfyUI Manager and restart.

Gotchas

This node does not load a model - you still need the Qwen text encoder sitting in the clip input. The pack's requirements drag in transformers and qwen-vl-utils even if that's all you use, so expect a chunky install for what is conceptually a thin node. And if you need more than one reference image, the same source file also registers AQ_TextEncodeQwenImageEditPlus, which takes up to three images plus a menu of prompt templates (style transfer, scene reimagining, multi-image blend…). For multi-image or templated workflows, that's the one you want; this node is the single-image original.

Categoryadvanced/conditioning

Inputs (5)

NameTypeDefaultDescription
clipCLIP
promptSTRING
use_imageBOOLEANtrue
vaeoptVAE
imageoptIMAGE

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING