Nodes/ComfyUI-Recolor/🎨 Multi-Zone Recolor
ComfyUI Node

🎨 Multi-Zone Recolor

Recolor a t-shirt's body, stripes and logo in one pass

By benjamin-bertramΒ·Created 6 months agoΒ·Updated 6 months agoΒ· 1
🎨 Multi-Zone Recolor
  • image
  • mask_0
  • mask_1
  • mask_2
  • mask_3
  • mask_4
  • mask_5
  • mask_6
  • mask_7
  • recolored
β—„zone_config[]β–Ί
β—„methodβ–Ύβ–Ί
β—„luminance_strength0.70β–Ί
β—„texture_preserve0.15β–Ί
β—„edge_feather2β–Ί

One garment, three different colors, no compositing

The single-zone nodes recolor one region. Real apparel rarely has one region - a t-shirt has a body, stripes, and a logo, each getting a different color in a given colorway. This node is the one that does all of them in a single pass: you feed up to eight masks, write a small JSON config that says which mask gets which color, and it applies each recolor in sequence, chaining the results so the image you get back has every zone done.

It's the node that makes a colorway pipeline feel like a pipeline. The README's example is a three-stripe tee: three SAM clicks, three masks, one JSON, one output image that's a full recolored garment.

The zone_config is the whole interface

The config is a JSON array where each entry maps a mask_index to a target RGB. Index refers to the input you wired up - mask_0 through mask_7 - not to anything in the image. The README's turquoise example:

[
  {"mask_index": 0, "r": 88,  "g": 148, "b": 134, "label": "Main"},
  {"mask_index": 1, "r": 4,   "g": 0,   "b": 0,   "label": "3 stripes"},
  {"mask_index": 2, "r": 4,   "g": 0,   "b": 0,   "label": "Logo"}
]

Only zones listed in the config get recolored, and only zones with a connected mask actually do anything - you can leave mask_2 unplugged and it's simply skipped. Keep the labels; they're documentation, not logic, but they save you from guessing what index 3 was an hour later.

The inputs that matter

  • image + zone_config + the optional mask_0…mask_7 inputs.
  • method - this is the interesting one. It's a dropdown (direct_replace, statistical, percentile) that switches the underlying algorithm for every zone at once. Direct replace = exact flat color per zone (the safe default); statistical = keep the source's tonal variation; percentile = robust to highlights. Under the hood MultiZone just calls the matching single-zone node per zone, so the trade-offs are the same ones those nodes document.
  • luminance_strength, texture_preserve, edge_feather - the shared tuning knobs. Note that texture_preserve is really a direct_replace setting; in statistical or percentile mode the same slider feeds that method's spread/range parameter instead, so expect different behavior from the same number.

Output is a single recolored IMAGE - the zones are already composited, so it wires straight into a preview or Save Image.

Getting the masks

MultiZone doesn't segment anything; you supply the masks. The standard flow is SAM via ComfyUI-Impact-Pack - click the body, click the stripes, click the logo, wire each mask to a slot. That's a few clicks and it works. AutoColorZoneSegmenter (same pack) is the no-click alternative, with the caveat that it clusters by color rather than by meaning.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/benjamin-bertram/ComfyUI-Recolor
cd ComfyUI-Recolor
pip install -r requirements.txt

Restart ComfyUI, or install from Manager by searching "ComfyUI-Recolor". No model downloads - the dependencies are torch, opencv-python, and scikit-image. The SAM weights live in Impact Pack, not here.

A couple of real-world notes: malformed JSON in zone_config throws a parse error, so validate the config in any JSON editor before pasting it in. And masks are processed in list order, so overlapping masks will fight - keep them non-overlapping or you'll see the later zone win the overlap.

CategoryAICG/Recolor

Inputs (14)

NameTypeDefaultDescription
imageIMAGEβ€”
zone_configSTRING[]β€”
methodCOMBO3 options: direct_replace, statistical, percentile
luminance_strengthFLOAT0.700–1β€”
texture_preserveFLOAT0.150–1β€”
edge_featherINT20–50β€”
mask_0optMASKβ€”
mask_1optMASKβ€”
mask_2optMASKβ€”
mask_3optMASKβ€”
mask_4optMASKβ€”
mask_5optMASKβ€”
mask_6optMASKβ€”
mask_7optMASKβ€”

Outputs (1)

NameTypeDescription
recoloredIMAGEβ€”