ComfyUI Node

LockPixel Qwen Encode

One Encode, Two Uses

By tori29umai0123·Created 2 months ago·Updated 2 months ago· 17
LockPixel Qwen Encode
  • clip
  • vae
  • image1
  • image2
  • image3
  • conditioning
  • latent
prompt
latent_image_index1
vl_target_size384
vl_upscale_method
qwen_2511true

Qwen-Image-Edit's dirty secret is that it re-emits the whole frame. Every edit, even "change the dress to blue," runs the entire image through the model again, and the pixels you didn't touch come back slightly different - shifted, zoomed, offset. The community named it the offset problem back in September 2025, and the 2511 release claims to mitigate it, but the honest workaround is architectural: make the reference latent and the sampler latent the same grid. LockPixelQwenEncode is the node that does that, and it's the heart of this pack.

Qwen-Edit conditions on its input image two ways at once: a vision-language model reads the image for understanding, and a VAE encode provides the spatial reference. The standard TextEncodeQwenImageEditPlus internally resizes that reference toward 1MP - which is exactly how the reference grid and your sampler grid drift apart. LockPixelQwenEncode skips the 1MP resize entirely: it encodes the padded image at its native resolution, once, and uses that same latent for both the conditioning's reference_latents and the latent you feed the sampler.

What goes in

  • clip (CLIP), vae (VAE), prompt (STRING, multiline) - the standard Qwen-Edit trio, loaded the usual way (UNETLoader / CLIPLoader / VAELoader for the checkpoint side; this pack adds no weights of its own).
  • image1 / image2 / image3 (IMAGE, optional) - up to three reference images, matching Qwen-Edit 2509's multi-image editing.
  • latent_image_index (INT, default 1, range 1–3) - when you feed several images, this picks which reference latent becomes the sampler latent. Leave at 1 for the single-image case.
  • vl_target_size (INT, default 384, range 256–1024) - the resolution the vision-language side gets resized to. Yes, your image gets small on that path: that's the text/vision understanding side, and it's normal. The spatial reference stays full-res.
  • vl_upscale_method - area (default), lanczos, or bicubic. area is the safe pick for downscaling; go lanczos if the VL side keeps missing detail.
  • qwen_2511 (BOOLEAN, default True) - sets the reference_latents_method: index_timestep_zero conditioning metadata the 2511 checkpoint expects. If you run the 2509 build, flip this off.

What comes out

Two outputs, and they're the whole point. conditioning carries the prompt with the reference latents attached. latent is the same latent that's sitting inside that conditioning - which is the trick. Wire latent into the KSampler's latent_image and reference grid == sampler grid by construction:

LockPixelPadImage -> LockPixelQwenEncode (conditioning) -> KSampler positive
                    LockPixelQwenEncode (latent)      -> KSampler latent_image
KSampler -> VAEDecode -> LockPixelCropBack

Feed no images at all and the node falls back to a blank 1024×1024 latent with no reference - you generally want at least one image in the frame.

Gotchas, learned the honest way

  • Don't also run the same reference through the standard TextEncodeQwenImageEditPlus with a VAE - that's the drift path you're trying to leave behind. Pick one encoder per workflow.
  • On 2511, keep qwen_2511 on. It's not just a version label; it sets conditioning metadata the newer checkpoint is trained against.
  • It fixes the grid, not the pixels. VAE encode/decode is lossy, so untouched regions come back close-but-not-identical. The pack's README says it plainly, and the fix for strict cases is masking the original back over the result.
  • This shines for line extraction, retouching, partial edits and manga panels - layout-alignment work where a subtle zoom ruins everything. The author, tori29umai, is the same person behind the community's Qwen-Edit lineart extraction LoRA, and he'd been documenting this shifting-pixels problem before he built the node around it.

Install is one line and dependency-free (no requirements.txt; it leans on ComfyUI's own node_helpers):

cd ComfyUI/custom_nodes
git clone https://github.com/tori29umai0123/ComfyUI-QwenImageEdit-LockPixel

Restart, find qwen image edit/lockpixel in the node list, or install via ComfyUI Manager by searching "LockPixel". You still bring your own Qwen-Image-Edit checkpoint - a GGUF or fp8 quant for consumer cards - plus its CLIP and VAE, but the drift fix is now three nodes, not a research project.

Categoryqwen image edit/lockpixel

Inputs (10)

NameTypeDefaultDescription
clipCLIP
vaeVAE
promptSTRING
image1optIMAGE
image2optIMAGE
image3optIMAGE
latent_image_indexoptINT11–3
vl_target_sizeoptINT384256–1024
vl_upscale_methodoptCOMBO3 options: area, lanczos, bicubic
qwen_2511optBOOLEANtrue

Outputs (2)

NameTypeDescription
conditioningCONDITIONING
latentLATENT