Nodes/DenRakEiw_Nodes/🎨 Latent Color Match *DRE
ComfyUI Node

🎨 Latent Color Match *DRE

Color-match your images without ever leaving latent space

By DenRakEiwΒ·Created about a year agoΒ·Updated a day agoΒ· 34
🎨 Latent Color Match *DRE
  • latent
  • reference
  • LATENT
β—„methodLABβ–Ί
β—„factor1.00β–Ί
β—„deviceβ–Ύβ–Ί
β—„batch_size0β–Ί
β—„anti_aliasingfalseβ–Ί

Color matching - making one image take on the color character of another - usually means decode both to pixels, do statistics in some color space, re-encode. That's a full VAE round-trip and it costs time and VRAM. LatentColorMatch_DRE skips it: it does the matching directly on the latent tensors, and that's the entire appeal. The README claims roughly 10x faster than image-based methods, no VAE encode/decode, and about 50% less VRAM. In the integrated *DRE version the math is identical to the standalone pack; the suffix just stops node-ID collisions with the author's separate Latent_Nodes pack.

How it works

You give it two latents: the one you want to change (latent) and the reference whose colors you want it to adopt. Both come from VAE-encode nodes - so your upstream is Image β†’ VAE Encode β†’ Latent Color Match β†’ VAE Decode β†’ Save, the exact chain the README draws. Internally it's a port of cubiq's image-space color matcher, adapted to work on latent samples, with two families of methods:

  • kornia color spaces: LAB, YCbCr, RGB, LUV, YUV, XYZ - statistics (mean/std) transfer per channel in that space. LAB is the default and the usual best pick; the "perceptual" spaces keep hues saner than raw RGB.
  • color-matcher algorithms: mkl (Monge-Kovalevsky-LΓΌtzenburg), hm (Horn-Morris), reinhard, mvgd, and the chained combos hm-mvgd-hm and hm-mkl-hm - these are the classic image-color-transfer algorithms, applied at latent scale.

Inputs that matter

  • latent + reference (LATENT) - target and reference, both required.
  • method - start with LAB; if edges or hue are doing something weird, mkl is the usual next stop.
  • factor (0.0–3.0, default 1.0) - how strongly to apply the match. 1.0 is full transfer; dial back to 0.2–0.5 for a subtle tint so it doesn't look like a filter was slapped on.
  • device - auto, cpu, gpu. auto is fine.
  • batch_size (default 0 = auto) and anti_aliasing (default off) - leave alone until you're chasing specific artifacts.

Output: LATENT - feed it straight to a KSampler or a VAE decode. One LATENT out, and it's a single-socket node: no image round-trip, no IMAGE output to re-encode.

Where it shines

This is the classic "match the lighting and mood of a hero image across a batch" job - taking a reference photo's warm palette and stamping it onto generated frames, or normalizing a batch of renders so they cut together. Because it runs in latent space, you can also slot it before the sampler in an img2img chain, which image-space matchers can't do without an encode break. That's the genuinely different niche.

Install and caveats

Part of DenRakEiw_Nodes - ComfyUI Manager β†’ "DenRakEiw Nodes", or git clone https://github.com/DenRakEiw/DenRakEiw_Nodes, pip install -r requirements.txt, restart. It needs kornia>=0.6.0 and color-matcher>=0.2.0, which the requirements file pins.

The honest caveat: latent-space color math is a heuristic, and the further your two images are in content and composition, the stranger the transfer gets - a landscape's palette stamped onto a portrait can shift skin tones in ways image-space methods do too, just faster here. And it's a one-author pack with no community to speak of, so the GitHub issues page is where support lives. But for the batch-normalization job, this is the node that's actually worth installing the pack for.

Categorydenrakeiw/latent

Inputs (7)

NameTypeDefaultDescription
latentLATENTβ€”
referenceLATENTβ€”
methodCOMBOLAB12 options: LAB, YCbCr, RGB, LUV, YUV, XYZ, +6
factorFLOAT1.000–3β€”
deviceCOMBO3 options: auto, cpu, gpu
batch_sizeINT00–1024β€”
anti_aliasingBOOLEANfalseβ€”

Outputs (1)

NameTypeDescription
LATENTLATENTβ€”