ComfyUI Node

PVL Color Match

Steal the color grade from one image and slap it on another

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Color Match
  • image_ref
  • image_target
  • attention_mask
  • image
methodmkl
strength1.00

You generated an image that's technically correct but the color is all wrong next to the reference. Or you've got a batch of images that don't match each other's white balance. PVL Color Match is the local, no-API node that fixes exactly that: it transfers the color statistics from a reference image onto a target image. It lives in the pvlprk/comfyui-pvl-api-nodes pack and wraps the well-known color-matcher Python library, so the science is the standard one - no network call, no key, nothing leaves your machine.

This is a "reach for it right before you call it done" node: a final color-grade pass to make your output sit naturally next to other images, or a quick harmonizer for multi-image composites.

How it works

It runs the target through color_matcher.ColorMatcher.transfer() against the reference, with your choice of method. The method names come straight from the library:

  • reinhard - classic mean/std transfer in LAB space, the gentle default.
  • mkl (default) - Monge-Kantorovich linear transfer, stronger and usually the one to pick.
  • hm - per-channel histogram matching, aggressive.
  • mvgd - multi-variate Gaussian distribution transfer.
  • hm-mvgd-hm / hm-mkl-hm - the chained combos the library ships.

strength (default 1.0, 0-10) scales how much of the correction gets applied - 0.3 gives a subtle grade, 3.0 is heavy-handed. The clever bit is attention_mask: white region defines the analysis area on both images, everything outside gets flattened to its own masked mean for analysis only, and the resulting correction is applied to the full original target. So you can match skin tones using just the faces, then apply that grade to the whole frame.

Inputs and outputs

  • image_ref (the look you want) and image_target (the image being corrected) - both required IMAGE.
  • method, strength, attention_mask (optional MASK).
  • Output: image (the corrected IMAGE).

Install

The node imports color-matcher at runtime, so beyond the pack itself:

cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes

then make sure color-matcher is installed (pip install color-matcher - ComfyUI Manager handles it via the pack's requirements, which pins color-matcher==0.5.0). If it's missing, the node raises a clear "did you install requirements.txt?" error.

Where people get burned

  • Reference batch must be 1 or match target batch. One reference can grade a whole batch; a per-frame reference set must line up with the target batch or you'll get a shape error.
  • The mask is for analysis, not for output. White defines where the color stats come from; the correction then applies to the whole image. If you expected a masked, region-local recoloring, read the description again - this is a grade, not a repaint.
  • Method choice is everything. hm can band or posterize; reinhard can look washed. mkl at strength ~1 is the safe first shot, and lower strength when the reference's grade is extreme.
CategoryPVL_tools/image

Inputs (5)

NameTypeDefaultDescription
image_refIMAGE
image_targetIMAGE
methodCOMBOmkl6 options: mkl, hm, reinhard, mvgd, hm-mvgd-hm, hm-mkl-hm
strengthoptFLOAT1.000–10
attention_maskoptMASK

Outputs (1)

NameTypeDescription
imageIMAGE