Recolor parts of an image by segmentation and LAB adjustments
Package profile
README
cd ComfyUI/custom_nodes/
git clone <repo-url> ComfyUI-Product-Recolor
# or just copy the folder
cd ComfyUI-Product-Recolor
pip install -r requirements.txt
Install ONE of these for product masking:
Sources
3 sourcesVerified Sep 13
Source excerpts
1 excerptSource context: Repo benjamin-bertram/ComfyUI-Recolor
Option A: SAM (Recommended)
# ComfyUI-Impact-Pack (includes SAM integration)
cd ComfyUI/custom_nodes/
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
Option B: GroundingDINO + SAM
cd ComfyUI/custom_nodes/
git clone https://github.com/IDEA-Research/GroundingDINO
Option C: rembg (simple background removal)
pip install rembg onnxruntime
Single-zone recoloring. Connect a mask + target RGB → recolored image.
| Input | Type | Description |
|---|---|---|
image | IMAGE | Source product photo |
mask | MASK | Region to recolor (from SAM) |
target_r/g/b | INT | Target RGB values (0–255) |
luminance_blend | FLOAT | 0.0 = keep original brightness, 1.0 = match target exactly. Recommended: 0.5–0.7 |
saturation_boost | FLOAT | 1.0 = no change, >1 = more vivid |
edge_feather | INT | Blur mask edges (pixels) for smooth blending |
Recolor multiple zones at once. Takes up to 8 masks + a JSON config.
K-Means clustering to auto-detect color zones within a product mask. Outputs up to 8 separate zone masks.
Process ALL colorways in a single pass. Input JSON array of colorway definitions → batch of recolored images.
Parse "R, G, B" strings into individual values.
Generate color swatch images for visual comparison.
┌─────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌──────────┐
│ Load Image │────→│ SAM Segment │────→│ 🎨 Precise LAB │────→│ Save │
│ (KT4116) │ │ (pants) │ │ Recolor │ │ Image │
└─────────────┘ └──────────────┘ │ │ └──────────┘
│ target: 66,17,34│
│ lum_blend: 0.6 │
└─────────────────┘
Steps:
┌────────────┐ ┌──────────────┐
│ Load Image │────→│ SAM Segment │──→ mask_0 (main body)
│ (JD1906) │ │ (3 clicks) │──→ mask_1 (stripes)
└────────────┘ └──────────────┘──→ mask_2 (logo)
│
▼
┌──────────────────┐ ┌──────────┐
│ 🎨 Multi-Zone │────→│ Save │
│ LAB Recolor │ │ Image │
│ │ └──────────┘
│ zone_config JSON │
└──────────────────┘
zone_config for JX0732 (Turqoise):
[
{"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"}
]
┌────────────┐ ┌──────────────┐
│ Load Image │────→│ SAM Segment │──→ 7 masks (one per zone)
│ (TIRO25C) │ │ or Auto Zone │
└────────────┘ └──────────────┘
│
▼
┌──────────────────┐
│ ⚡ Batch Colorway │──→ 4 recolored images
│ Processor │ (JW4388, IW0454,
│
Nodes in this pack
7 nodesVerified Sep 26
Verified Sep 13