Qwen Consistency Edit — Encoder — by wallen0322
For portraits and products, this is the Qwen-Edit encoder you actually use
- clip
- image
- vae
- image2
- image3
- conditioning
- image
- latent
If you're editing a portrait, a product shot, or anything where the pixels that don't change matter as much as the ones that do, QI_RefEditEncode_Safe is the node from wallen0322's QI pack you should start with. The README's own advice: use this one in normal cases, reach for QI_TextEncodeQwenImageEdit_Safe when you want to explore. The difference is in the name - "RefEdit" runs a two-phase consistency scheme built specifically to fight Qwen-Edit's two famous failure modes: geometric offset and color drift.
How it works
Instead of one set of anchors, it runs two phases. Early in the schedule (roughly timesteps 0–0.6) it prioritizes editability - the text instruction gets room to act. Late (0.6–1.0) it reinforces consistency and detail, and a thin high-frequency tail right around the end cleans up edges and hair while suppressing artifacts. That's why it's described as Euler / low-CFG friendly by default: it doesn't need a heavy guidance schedule to hold the image together.
The color side is the clever bit. The node does a Linear BT.709 chroma match - it computes YCbCr statistics in linear light, aligns the chroma distributions of the edit against the reference with a Cholesky-transform, and applies highlight/lowlight attenuation so bright scenes don't blow out or shift green. This is the pack's answer to "my bright background came back with a green tint and clipped highlights."
The inputs that matter
- out_width / out_height - set both to your target size first, or leave at 0 to keep the input size. The pipeline computes at 32-alignment and crops back afterwards, which is what gives pixel-perfect alignment.
- quality_mode -
natural(default) /fast/balanced/best. These are tuned preset tables, not filters;bestleans harder on the reference (higher latent and pixel strengths),fastis for iterating. - prompt_emphasis (0–1, default 0.5) - and here's a subtlety: it only nudges pixel-reference convergence. The latent lock stays put. So raising it makes the text drive the edit harder without letting the geometry wander. ≥0.8 follows the text more.
- brightness_boost (0.8–1.3) - a gamma knob applied before VAE encode; handy for scenes where the model keeps darkening things.
- debug_info - prints the full geometry pipeline (input → work → padded → letterbox) to your console. Turn it on once if you're chasing misalignment.
Optional image2 and image3 plug into Qwen-Edit-2509's multi-image editing - person+person, person+product, person+scene. The whole computation is capped at 3MP, so it stays stable on big sources.
Wiring
Same shape as the other encoder: clip, prompt, image, vae in → conditioning, image, latent out, straight into a KSampler. The latent carries qi_pad crop metadata, so decode it with the pack's QI_VAEDecodeLockSize to get your exact original size back instead of a padded frame.
Installing
It's the same pack as the rest of the QI nodes - one install, five nodes. ComfyUI Manager, search ComfyUI-QI-QwenEditSafe, or:
cd ComfyUI/custom_nodes
git clone https://github.com/wallen0322/ComfyUI-QI-QwenEditSafe
Restart and you're done; there are no Python dependencies to pull. You still need the model itself - a Qwen-Image-Edit GGUF (or the Nunchaku INT4 loader from the sample workflow) plus your LoRA of choice, because 20B at bf16 is a data-center allocation, not a desktop one.
Gotchas
- Lock
out_width/out_heightbefore you change anything else; the whole pipeline derives from them. - The author's prompt tip applies double here: append 保持人物一致性不变,保持画风光影不变 ("keep the character consistent, keep the art style and lighting unchanged") for character work.
- Faces can still drift on identity - that's structural to the model. When it happens, crop, inpaint, stitch; don't fight the encoder.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| image | IMAGE | — | |
| vae | VAE | — | |
| out_width | INT | 00–16384 | — |
| out_height | INT | 00–16384 | — |
| prompt_emphasis | FLOAT | 0.500–1 | — |
| quality_mode | COMBO | natural | 4 options: natural, fast, balanced, best |
| brightness_boost | FLOAT | 1.000.8–1.3 | — |
| debug_info | BOOLEAN | false | — |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| conditioning | CONDITIONING | — |
| image | IMAGE | — |
| latent | LATENT | — |