DNF 原图空间色度锁定(不叠图)
Steal the original's colors without pasting it on top
- generated
- reference
- color_locked
The frustrating part of a key-art-to-pixel workflow is never the pixel step. It's that the img2img reroll nails your line art and composition but drifts the color - skin goes too red, the armor picks up a tint the original painting never had. DNFSpatialChromaLock is the fix that doesn't wreck anything else: it keeps your image's brightness, edges, and pixel structure exactly as they are, and swaps in the reference's color. The Chinese display name is explicit about the trick - "原图空间色度锁定(不叠图)": chroma locked from the source, no image overlay.
The mechanism is why this works where a soft-light blend or an opacity-stacked layer looks like garbage. Both images are converted to YCbCr, the same luminance/chroma split that JPEG uses under the hood. Your generated image's Y (luminance) channel - which carries all the shading, the line weight, the sense of form - is kept untouched at 100%. The reference's Cb/Cr (blue-difference and red-difference, i.e. hue and saturation) are grabbed instead and recombined with your luminance to make the output. It's chroma transfer in the proper color space, not a transparency blend, which is why the resulting colors sit inside your shapes instead of smearing over them.
Inputs you'll actually touch:
generatedandreference- both IMAGE.referenceis resized (LANCZOS) to match your generated frame, so exact pixel sizes aren't required, but framing should roughly match or the color lands in the wrong places.strength(0–1, default 1.0) - how much reference chroma replaces the generated chroma. 1.0 is full swap; drop to ~0.7 if the result feels like it lost your image's own mood.chroma_blur(0–8, default 1.0) - a Gaussian blur applied to the reference chroma before mixing. Original key art is noisy at the pixel level, and without this you can import texture you never wanted. Bump it if the flat colors come back blotchy.reference_chroma_boost(0.5–1.5, default 1.0) - saturation multiplier on the imported chroma, for when the painting reads a bit muted after the swap.
One output, color_locked, and it's pure NumPy/Pillow under the hood - a few seconds even on batches. Wire it straight into whatever downscales and quantizes next (in this pack, DNFReferencePaletteFinalize or DNFPixelPerfectFinalize).
Install is the easy kind. ComfyUI Manager → Custom Nodes Manager → search DNF Pixel Perfect Color Lock (registry id dnf-pixel-perfect), or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/yifu23333/ComfyUI-DNF-ColorLock
Restart ComfyUI. No requirements.txt, no model downloads, no runtime install scripts - the pyproject declares zero dependencies because it only uses the NumPy, Pillow, and torch your ComfyUI already ships. You'll find it under DNF/Color Lock in the node menu.
One thing to know before you blame it for a bad result: this node aligns by resizing, not by warping or matching features. If your reference is a different crop, pose, or framing than the generated image, the colors will be correct per-position and wrong per-feature - nothing this deterministic tool can do about that. Match your framing in the generation step and it behaves itself.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| generated | IMAGE | — | |
| reference | IMAGE | — | |
| strength | FLOAT | 1.000–1 | — |
| reference_chroma_boost | FLOAT | 1.000.5–1.5 | — |
| chroma_blur | FLOAT | 1.000–8 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| color_locked | IMAGE | — |