Nodes/ComfyUI_Mira/Color Transfer
ComfyUI Node

Color Transfer

Match one image's palette to another

By mirabarukaso·Created 2 years ago·Updated 5 days ago· 206
Color Transfer
  • src_image
  • ref_image
  • image
method

Color Transfer takes the colors of one image and stamps them onto another. You give it a source (the picture you want to recolor) and a reference (the picture whose palette you like), and it pushes the source's tones, warmth, and contrast toward the reference's. No prompting, no diffusion - it's pure statistics on pixels, which is why it's fast and predictable.

The practical reasons you'd want this: matching a generated image to a target aesthetic, unifying the look across a set of images that came out inconsistently, or - the use case the author added later - calibrating the color of video frames so a clip doesn't drift in tone. If you've ever had a batch where every image is fine but the color grading is all over the place, this is the fix that doesn't require regenerating anything.

How it works

It's a classical color-transfer algorithm (the node credits the python-color-transfer project) that computes the color distribution of the reference and remaps the source's distribution to match. Nothing is invented; the content of your source image is untouched, only its color statistics move. That's the important mental model - it re-grades, it doesn't repaint. The four methods are just increasingly thorough ways of doing that remap, trading speed for fidelity.

The inputs that matter

There are only three, and one of them decides everything:

  • src_image - the image getting recolored.
  • ref_image - the image whose palette you're borrowing.
  • method - Mean, Lab, Pdf, or Pdf+Regrain, in ascending order of "how hard it works." This is the whole node, so it's worth knowing the trade the author benchmarked on a ~2336×3488 image:

| Method | Speed | Feel | | --- | --- | --- | | Mean | instant (~1.8s) | shifts the average tone; the fast, safe default | | Lab | almost instant (~2.5s) | works in Lab color space, a bit more faithful | | Pdf | slow (~18s) | matches the full color distribution | | Pdf+Regrain | go make coffee (~50s) | best match, adds a regrain pass to fix texture |

Output is a single image.

The honest take

Start with Mean or Lab. They're nearly free and they're good enough for the overwhelming majority of "make this match that" jobs. Pdf and especially Pdf+Regrain give a tighter match, but the cost is real - Pdf+Regrain is roughly 28x slower than Mean, and on a batch or on video frames that adds up to a genuinely long wait. Reach for them only when a Mean/Lab result visibly isn't close enough. For video color calibration, test on a single frame first with the cheap method before you commit a whole clip to Pdf+Regrain.

Install

ComfyUI Manager → search ComfyUI_Mira → Install → restart. Or clone: cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git, restart. If the pack throws a load error, run pip install -r requirements.txt in ComfyUI/custom_nodes/ComfyUI_Mira - the color-transfer code has its own dependencies that this pulls in. No model files to download.

Common issues

If a run feels frozen, it probably isn't - Pdf+Regrain genuinely takes ~50 seconds on a big image, and that scales up fast across a batch. Check which method you're on before assuming the node hung. If the recolor looks too aggressive or washes out your source, drop to Mean, which only shifts the overall tone and is the gentlest option. And pick a reference whose lighting is actually what you want - the node faithfully copies whatever palette you feed it, so a badly-lit reference gives you a badly-lit result.

CategoryMira/Util/Image

Inputs (3)

NameTypeDefaultDescription
src_imageIMAGE
ref_imageIMAGE
methodCOMBO4 options: Mean, Lab, Pdf, Pdf+Regrain

Outputs (1)

NameTypeDescription
imageIMAGE