Conditioning Add Image Reference
The 'attach my reference image to conditioning' node for Kontext, Qwen Edit, and Klein
- conditioning
- vae
- image1
- image2
- image3
- CONDITIONING
Here's the thing people stumble on the first time they open a Flux Kontext or Flux 2 Klein workflow: the reference image does not go through an adapter. No IP-Adapter, no embedding injection. The image gets VAE-encoded into a latent and literally stapled onto your conditioning as a reference_latent, and the model consumes it in-context while it denoises. ConditioningAddImageReference is the stapler.
The name undersells it slightly. It's from BigStationW's edit-model pack, and it does exactly one job: take a conditioning you already made, append the VAE latents of one to three images to it, and hand you the result. That's the whole node. If you're building a Qwen Image Edit, Kontext, or Klein workflow and you want to build your prompt with a different node - the stock CLIP Text Encode (Prompt), or something like prompt-control - this is the piece that attaches the image while leaving your text pipeline alone.
How it works
For each connected image, in order, it runs vae.encode() on the pixels and collects the latents. Once it has them, it stores them on the conditioning under the reference_latents key (appended, not overwritten, so you can chain multiple nodes and stack more references). Downstream, a core ComfyUI node like FluxKontextMultiReferenceLatentMethod wired into your sampler decides how those latents are used during denoising.
Two details are worth knowing because both bite silently:
- No VAE, nothing happens. The encode only runs when an image and the VAE are both connected. Forget the VAE and the node passes your conditioning through unchanged - no error, no warning, just a text-to-image result with no reference at all.
- It encodes at full input resolution. There's no resizing inside this node. The author's own Qwen workflow feeds images through
ImageScaleToTotalPixels(about 1 MP) first, specifically to avoid the oversized-input problems both Kontext and Qwen Edit are known for - that geometric offset that skews proportions. Scale your input before this node, not after.
Inputs and output
The inputs that matter for a beginner:
- conditioning (required) - the text conditioning you built elsewhere.
- vae (optional) - the model's VAE. For Qwen that's
qwen_image_vae.safetensors; for Klein it's the Flux VAE. This is the one people forget. - image1 / image2 / image3 (optional) - up to three references.
- max_images_allowed -
"0"through"3", default"3". Images are processed in order 1→2→3;"0"means none, which turns the node into a pure passthrough.
Output is a single CONDITIONING, which you wire into your sampler's positive (or negative - see the Dual variant if you run both).
Install
From ComfyUI Manager, search ComfyUi-TextEncodeQwenImageEditAdvanced. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/BigStationW/ComfyUi-TextEncodeQwenImageEditAdvanced
Then restart ComfyUI. The repo has no requirements.txt and pulls nothing beyond core ComfyUI - the real install cost is the models (the edit checkpoint, VAE, and for Qwen the 2.5-VL text encoder), which live in your models/ folders like any other model.
One trap: the README's own clone URL still says ComfyUi-TextEncodeEditAdvanced, which is the repo's old name. Use the URL above.
Common issues
- The reference seems ignored - check the VAE is connected. This is the #1 cause.
- Distorted proportions / offset output - you fed it a huge image and it encoded the whole thing. Downscale to ~1MP upstream.
- Node won't appear - this pack leans on recent core ComfyUI for the reference-latent mechanism. The community's standard fix for "node missing" with this author's Qwen nodes is updating ComfyUI itself, not the node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| max_images_allowed | COMBO | 3 | Maximum number of images to process. Images are processed in order: image1, image2, image3 |
| vaeopt | VAE | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |