π¨ Multi-Zone Recolor
Recolor a t-shirt's body, stripes and logo in one pass
- image
- mask_0
- mask_1
- mask_2
- mask_3
- mask_4
- mask_5
- mask_6
- mask_7
- recolored
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_preserveis 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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| zone_config | STRING | [] | β |
| method | COMBO | 3 options: direct_replace, statistical, percentile | |
| luminance_strength | FLOAT | 0.700β1 | β |
| texture_preserve | FLOAT | 0.150β1 | β |
| edge_feather | INT | 20β50 | β |
| mask_0opt | MASK | β | |
| mask_1opt | MASK | β | |
| mask_2opt | MASK | β | |
| mask_3opt | MASK | β | |
| mask_4opt | MASK | β | |
| mask_5opt | MASK | β | |
| mask_6opt | MASK | β | |
| mask_7opt | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| recolored | IMAGE | β |