ComfyUI Node

MX_ColorMatch

Steal the color grade of one image and paste it onto another

By Intersection98·Created 2 years ago·Updated 2 years ago· 13
MX_ColorMatch
  • image_ref
  • image_target
  • image
methodmkl

ColorMatch is the node that solves a specific, annoying problem: you generated an image, then you saw another image whose color grade you want - warm shadows, teal highlights, whatever - and you'd rather copy that whole look than rebuild it by hand. It takes a reference image, a target image, and hands the target the reference's color statistics. The result isn't a style transfer; it's a color-space match, which is exactly what you want when the composition is right and only the grade is wrong.

It's part of Intersection98/ComfyUI-MX-post-processing-nodes, and it's one of the few nodes in the pack that pulls in a real third-party library: color-matcher (the ColorMatcher Python package). The pack's requirements list it, and only this node needs it.

How it works

The node feeds both images through color_matcher.ColorMatcher.transfer(), which shifts the target's color statistics toward the reference's. The six method options are the different statistical models in that library:

  • reinhard - the classic mean/std-dev transfer from the Reinhard et al. paper.
  • mkl - Monge-Kodak-Lukac, the default and generally the safest all-rounder.
  • mvgd - multivariate Gaussian distribution matching, more thorough than reinhard.
  • hm - histogram matching, which can hit the reference's grade harder but is more prone to artifacts.
  • hm-mvgd-hm and hm-mkl-hm - chained variants that combine histogram matching with a distribution method.

If in doubt, leave it on mkl. It's the default for a reason.

The inputs that matter

  • image_ref - the image whose look you want. A single reference is fine; if you pass a batch, it must match the target batch size or the node raises a clear error.
  • image_target - the image being regraded. Output keeps its own composition, sharpness, and lighting structure, just re-colored.
  • method - one of the six above. mkl to start.

Output is a single image (that's the return name - lowercase), same resolution as the target, ready to wire into a save node or further MX effects.

Install

Standard MX pack install, but note the extra dependency. Via ComfyUI Manager (search MX or ComfyUI-MX-post-processing-nodes), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Intersection98/ComfyUI_MX_post_processing-nodes
cd ComfyUI_MX_post_processing-nodes
pip install -r requirements.txt

The requirements.txt includes color-matcher - if Manager or your manual install didn't run it, pip install color-matcher into your ComfyUI environment and restart. Without it, this node (and only this node) will fail to load. It's the sole dependency in the pack that isn't already on almost every ComfyUI install.

Where people get burned

The hm methods are the classic overcorrect: they can produce posterized bands in gradients or shift highlights into ugly territory. If a match looks "too strong" or blocks up, step down to mkl or reinhard rather than fighting the threshold sliders. Batch usage is the other gotcha - a mismatched reference batch throws a ValueError instead of failing gracefully, so feed one reference image unless you truly have per-frame references (useful for matching a consistent grade across a video's frames). For a beginner, the practical pattern is: reference one well-graded photo, target your render, default method, done.

Categorypostprocessing/Color Adjustments

Inputs (3)

NameTypeDefaultDescription
image_refIMAGE
image_targetIMAGE
methodCOMBOmkl6 options: mkl, hm, reinhard, mvgd, hm-mvgd-hm, hm-mkl-hm

Outputs (1)

NameTypeDescription
imageIMAGE