Palette Transfer Clustering
The 'just recolor it' node — cluster mapping with the boring knobs removed
- image
- target_colors
- IMAGE
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
IMAGEplus aCOLOR_LISTfrom ColorPalette. - palette_extension_method (
None/Dense/Edge, defaultNone) - the one knob this node shares with the fancier siblings.Denseinterpolates points between every pair of palette colors before clustering;Edgefinds "edges" via Delaunay triangulation and interpolates along those. Extending matters more here than in the main node because withNone, 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_colors | COLOR_LIST | — | |
| palette_extension_method | COMBO | None | 3 options: Dense, Edge, None |
| palette_extension_points | INT | 52–20 | — |
| gaussian_blur | INT | 30–27 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |