Nodes/ComfyI2I/Color Transfer
ComfyUI Node

Color Transfer

Recolor one image with another's palette — no model, no API key, pure math

By ManglerFTW·Created 3 years ago·Updated 2 years ago· 181
Color Transfer
  • source_image
  • target_image
  • mask
  • image
no_of_colors6
blur_radius2
blur_amount2
strength1.0
gamma1.0
contrast1.0
brightness1.0

Color Transfer is the standalone member of the ComfyI2I family, and the name is the opposite of a lie: it really does take the colors of one image and transfer them to another, in a fraction of a second, with no model, no API key, no sampling. It's pure image math - extract a palette, segment, replace, blend. If you've ever wanted a render to wear the color grading of a reference photo without the reference's content or layout, this is the node.

How it works

It extracts up to no_of_colors dominant colors from each of the two input images, segments the source by its own palette, and swaps each segment's color for a matched color from the target's palette. The matching is the clever bit: palettes are paired by luminance order - darkest source color with darkest target color, lightest with lightest - so the brightness structure and shading of your image survive the swap. Then strength controls how much of the original luminance to keep, blur_radius/blur_amount feather the segment edges so you don't get posterized hard lines, and gamma, contrast and brightness finish the job. There's an optional mask input that confines the whole transfer to a region.

One naming trap up front: source_image is the picture you're recoloring, and target_image is the palette donor. The example workflow ships it that way - your art into source_image, the style reference into target_image. Get it backwards and nothing bad happens, it just recolors the wrong image.

The inputs that actually matter

  • source_image - the image to change.
  • target_image - the image whose palette you're borrowing.
  • no_of_colors (default 6, up to 256) - colors extracted per image. The README's guidance is right: 5–20 is plenty for whole images, and drop to 1–5 for small masked regions so only the dominant tones survive.
  • strength (0–2, default 1) - how strongly to apply the transfer. Below 1 leaves more of the original look, which is often the better call for subtle regrades.
  • blur_radius / blur_amount - edge feathering on the segment boundaries. If the result looks like a cheap color-quantized poster, these are what you raise.
  • mask - optional. Feed it a mask and only the masked area gets recolored; everything else stays untouched.

Output is a single image IMAGE - save it, preview it, or keep it flowing into the rest of your graph.

Install

The pack ships with ComfyUI Manager - search "ComfyI2I" (or ManglerFTW/ComfyI2I). Manual route:

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

Restart ComfyUI and it appears under the I2I category. Note the requirements file lists tensorflow and scikit-image that the code never imports - wasted download, and this node itself only needs numpy, opencv and torch. On Linux or non-admin Windows, ComfyUI needs write access to custom_nodes/ComfyI2I/ComfyI2I.py since the pack copies its JS into web/extensions at startup.

Common issues

  • Posterized bands instead of a smooth regrade. no_of_colors is too low for the image, or you skipped the blur. Raise colors into the 10–20 range and give blur_radius/blur_amount a couple of points.
  • Result looks flat or over-saturated. That's the strength/gamma/contrast stack fighting you. Drop strength to 0.5–0.8 first - it's the gentlest knob - then touch gamma only if the overall brightness is off.
  • Hard-edged rectangle where the mask was. Feather the mask upstream (Mask Ops' blur_radius does this) so the transfer fades instead of clipping.
  • Only the first frame changes. The node operates on the first image of each input batch, so feed it single images or batch your processing yourself.

It pairs especially well with Mask Ops - keep that node's separate_mask at 0 and feed its output into mask for a targeted regrade, which is exactly how the pack's own multi-color-transfer workflow is built. The whole pack has been dormant since late 2023, but color math doesn't rot the way models do; this node is a legitimately useful, dependency-free utility that still does its one job cleanly.

CategoryI2I

Inputs (10)

NameTypeDefaultDescription
source_imageIMAGE
target_imageIMAGE
no_of_colorsINT60–256
blur_radiusINT20–100
blur_amountINT20–100
strengthFLOAT1.00–2
gammaFLOAT1.00.1–2
contrastFLOAT1.00–3
brightnessFLOAT1.00–100
maskoptMASK

Outputs (1)

NameTypeDescription
imageIMAGE