Nodes/ComfyUI-QI-QwenEditSafe/Qwen Consistency Edit — Encoder — by wallen0322
ComfyUI Node

Qwen Consistency Edit — Encoder — by wallen0322

For portraits and products, this is the Qwen-Edit encoder you actually use

By wallen0322·Created 12 months ago·Updated 10 months ago· 56
Qwen Consistency Edit — Encoder — by wallen0322
  • clip
  • image
  • vae
  • image2
  • image3
  • conditioning
  • image
  • latent
prompt
out_width0
out_height0
prompt_emphasis0.50
quality_modenatural
brightness_boost1.00
debug_infofalse

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; best leans harder on the reference (higher latent and pixel strengths), fast is 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_height before 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.
CategoryQI by wallen0322

Inputs (12)

NameTypeDefaultDescription
clipCLIP
promptSTRING
imageIMAGE
vaeVAE
out_widthINT00–16384
out_heightINT00–16384
prompt_emphasisFLOAT0.500–1
quality_modeCOMBOnatural4 options: natural, fast, balanced, best
brightness_boostFLOAT1.000.8–1.3
debug_infoBOOLEANfalse
image2optIMAGE
image3optIMAGE

Outputs (3)

NameTypeDescription
conditioningCONDITIONING
imageIMAGE
latentLATENT