ComfyUI Node Runs on cloud

ColorMatchV2

Match one image's color grade to another

By kijai·Created 3 years ago·Updated 2 days ago· 3,011
ColorMatchV2
  • image_target
  • image_ref
  • image
methodmkl
strength1.00
multithreadtrue

Color drift is one of those problems you don't notice until you do, and then you can't unsee it. Upscale a video and the tones shift. Stitch generated frames onto real footage and the palette doesn't sit right. Run an img2img pass and the whole thing goes slightly warm. ColorMatchV2 fixes that: it transfers the color character of a reference image onto your target so the two match.

It lives in kijai's KJNodes and wraps the color-matcher library, so this isn't a hand-rolled tint, it's a set of proper statistical color-transfer methods. It's the node people reach for in video pipelines to keep tone consistent across an upscaled or extended clip, and in compositing to marry a generated element to a plate.

How it works

You give it two images: the image_target (the one you want to recolor) and the image_ref (the one whose look you want to copy). It analyzes the reference's color distribution and remaps the target to match it. Under the hood these are the classic color-transfer algorithms, Reinhard's mean/std transfer, the Monge-Kantorovich linearization (MKL), a multivariate-Gaussian transfer, and histogram matching, plus the library author's HM-MVGD-HM compound that the description says outperforms the individual methods.

The inputs and outputs that matter

  • image_target - the image to be recolored.
  • image_ref - the image whose color grade you're matching to.
  • method (default mkl) - which transfer algorithm to use. mkl is a solid default. The description also names reinhard, the MVGD/HM family, the compound hm-mvgd-hm, and a reinhard_lab_gpu variant that runs in Lab color space on the GPU via Kornia (worth trying if you're processing a lot of frames and want it accelerated). Different methods suit different footage; if one over- or under-corrects, swap it.
  • strength (default 1.0, range 0–10) - how far to push toward the reference. 1.0 is a full match; dial it down toward 0 for a subtle nudge when a full transfer looks too aggressive. It goes above 1 too, if you want to over-drive the effect.
  • multithread (default on) - leave it on for speed on batches.

The output is image, your target wearing the reference's colors.

Installing it

Most people already have KJNodes. If not: ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Restart ComfyUI. The color-matcher dependency is covered by that requirements.txt install, so make sure you actually run it, skipping the pip step is the usual reason this node fails to load.

Common issues

The node errors on load / "color-matcher not found." You cloned the repo but skipped pip install -r requirements.txt. Run it (in the portable build, use python_embeded\python.exe -m pip install -r ...), then restart.

The match is too strong and looks unnatural. Pull strength down. A full 1.0 transfer forces the target's entire distribution onto the reference, which can flatten contrast or introduce a cast; 0.5–0.8 often looks more natural.

Different methods give wildly different results. That's expected, they're genuinely different algorithms. If mkl overshoots, try reinhard for a gentler mean/std shift, or the hm-mvgd-hm compound for the library's best-quality path. It's worth A/B-ing a couple on your actual footage.

Color still drifts across a long video. Match every frame to the same single reference frame, not to the previous frame, otherwise small errors compound down the clip. A fixed reference keeps the whole sequence anchored.

CategoryKJNodes/image

Inputs (5)

NameTypeDefaultDescription
image_targetIMAGE
image_refIMAGE
methodCOMBOmkl7 options: mkl, hm, reinhard, mvgd, hm-mvgd-hm, hm-mkl-hm, +1
strengthFLOAT1.000–10
multithreadBOOLEANtrue

Outputs (1)

NameTypeDescription
imageIMAGE