Extensions/ComfyUI-PixelLock
ComfyUI Extension

ComfyUI-PixelLock

Pixel-Lock for Qwen-Edit: keep unedited pixels untouched (no drift/rot). Auto-bypass global/style edits. Tested across 374 edits.

By GritAI-Labs·Created 6 days ago·Updated 6 days ago· 0
GritAI-Labs/ComfyUI-PixelLock
Nodes2
On cloudLocal install
CategoryPixelLock
Stars0
Updated6 days ago
Readme

ComfyUI-PixelLock

Keep Qwen-Edit from touching the pixels you didn't ask it to change.

Qwen-Image-Edit rescales the whole image to ~1MP and redraws it, so a local edit — "change the shirt to red" — also drifts the face and background, and degrades a little more every round you edit. This node composites only the region the edit actually changed back onto your original, at original resolution, so everything you didn't touch is pixel-identical.

It's not a model or a LoRA — it's a tiny, tensor-native post step. Zero dependencies.

Nodes

Pixel Lock Compositeoriginal IMAGE + edited IMAGEimage (locked) + change_mask. Auto-detects the changed region, feathers it, and pastes only that back onto the original.

Global Edit Guardedit_prompt STRINGbypass BOOLEAN. Some edits should change everything (oil painting, "make it night", replace the background). This reads your edit prompt and returns bypass=True for those, which you wire into Pixel Lock Composite.bypass so the lock steps aside. Without it, style edits get wrongly reverted (see below).

Example graph

Load Image ─► (original) ─────────────────────────►┐
Load Image ─► TextEncodeQwenImageEditPlus ─► KSampler ─► VAEDecode ─► (edited) ─► Pixel Lock Composite ─► Save Image
Edit Prompt ─► Global Edit Guard ─► (bypass) ──────────────────────────────────►┘

Parameters (defaults are validated — see below)

| param | default | what it does | |---|---|---| | threshold | 16 | pixel-diff (0–255) to count as "changed" — lower catches subtler edits | | blur | 3 | denoise the change map before thresholding | | dilate | 6 | grow the mask to fully cover the edit | | feather | 4 | soften the seam | | bypass | false | pass the raw edit through (wire Global Edit Guard here) | | mask (opt) | — | supply an explicit edit mask instead of auto-detect |

What it's good at — and what it isn't (tested, not guessed)

Validated across a 374-edit sweep (people/objects/scenes/animals × close-up/half/¾/full/wide × front/¾/profile/high/low/back × multiple sizes × multiple seeds) plus multi-round chains:

  • Best at contained local edits — accessories, garment color, small add/remove. On people, edits applied 107/107, and the lock preserved everything else. Strong across every framing (full-body, wide, half, ¾, close-up).
  • Multi-round: it stops the rot. Five rounds of local edits held the unedited pixels at zero drift while the un-locked chain accumulated degradation each round.
  • Global/style edits: use the Guard. Style transfers (oil painting, etc.) have a small pixel-diff but change the whole look, so a naive composite would revert them — the Global Edit Guard bypasses the lock for these. (In testing, ~8% of global edits were wrongly erased without the guard.)
  • Not for whole-subject transforms (recolor an entire object, restyle everything) — those aren't "local," and the node correctly passes them through.

Think of it as a correctness guarantee: unedited pixels stay identical and at full resolution. The payoff is biggest in multi-round and high-res workflows.

Install

Search PixelLock in ComfyUI-Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/GritAI-Labs/ComfyUI-PixelLock

Restart ComfyUI. No dependencies to install.

License

MIT. Built and tested by GritAI.