Nodes/ComfyUI-Color_Transfer/Palette Transfer Clustering
ComfyUI Node

Palette Transfer Clustering

The 'just recolor it' node — cluster mapping with the boring knobs removed

By 45uee·Created 2 years ago·Updated 5 months ago· 42
Palette Transfer Clustering
  • image
  • target_colors
  • IMAGE
palette_extension_methodNone
palette_extension_points5
gaussian_blur3

First, the naming elephant: the class is spelled PalleteTransferClustering with an e in "Pallete" - a typo the author never fixed. It doesn't affect the display name (that's "Palette Transfer Clustering", spelled right), but the misspelled string is what shows up in workflow JSON and what you'll grep for when a shared workflow says it's missing. Now that the pedantry's out of the way: this is the preset version of the pack's main Palette Transfer node.

What's preset, what's not

The main node gives you six distance metrics, three color spaces, two clustering methods, and a blur. This one hardcodes the sensible defaults - Mini batch Kmeans clustering, Euclidean distance, RGB color space - and only exposes three things:

  • image and target_colors - the same inputs as everywhere else: an IMAGE plus a COLOR_LIST from ColorPalette.
  • palette_extension_method (None / Dense / Edge, default None) - the one knob this node shares with the fancier siblings. Dense interpolates points between every pair of palette colors before clustering; Edge finds "edges" via Delaunay triangulation and interpolates along those. Extending matters more here than in the main node because with None, a small palette clusters your image into very few hard regions. Add extension and the mapping gets intermediate colors to play with - fewer harsh boundaries, richer result.
  • palette_extension_points (2–20, default 5) - how many interpolated colors per pair/edge.
  • gaussian_blur (0–27, default 3) - despite the name, this actually applies a median blur (cv2.medianBlur), which is the right tool for smoothing the salt-and-pepper noise that hard mapping creates. 0 gives you the clean cut-out look.

Output is a single IMAGE, ready for preview or save.

Why this node exists

Honestly? Convenience and speed. The hardcoded settings - MiniBatch, Euclidean, RGB - are the ones the README itself recommends for day-to-day use ("MiniBatchKMeans faster but can be less accurate"), so this node is the "just make it match" path: drop in an image and a palette, no decisions required. The main node is there when a result's off and you want to diagnose why (try LAB space, try a weighted distance, try full KMeans); this node is there when you don't care, you just want the sofa to be that red.

One genuine quirk to remember: because clustering runs on the image's dominant colors and maps them to nearest-swatch, the output is posterized by design. If the flat look surprises you, that's the algorithm, not a misconfiguration - reach for PalletteSoftTransfer or PaletteTransferReinhard for smoother results instead.

Install

Same pack-wide story - ComfyUI Manager search "Color_Transfer", or:

cd ComfyUI/custom_nodes
git clone https://github.com/45uee/ComfyUI-Color_Transfer

Restart after cloning. No models, no keys, CPU-only math. Dependencies are scikit-learn, opencv-python, POT, with the README's pip install scikit-learn as the standard import-error fix. Small solo-dev pack, but this node is the least likely to surprise you - it's the main algorithm with the decisions already made.

CategoryColor Transfer/Palette Transfer

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
target_colorsCOLOR_LIST
palette_extension_methodCOMBONone3 options: Dense, Edge, None
palette_extension_pointsINT52–20
gaussian_blurINT30–27

Outputs (1)

NameTypeDescription
IMAGEIMAGE