Convert LAB color space to RGB color space v5.1.0
The return trip for recoloring
- input_L
- input_A
- input_B
- Output RGB image
LAB 2 RGB is the second half of the pack's color-space round trip. The sibling node tri3d-RGB_2_LAB splits an image into three channels - L (lightness), A (green–red axis), B (blue–yellow axis) - so you can edit the color information separately from the brightness. This node takes those three channels back as inputs and rebuilds a normal RGB image via OpenCV's cv2.cvtColor(... COLOR_LAB2RGB). In, three MASKs; out, one IMAGE.
Why bother with LAB at all? Because it's the color space where "change the color without wrecking the brightness" is actually easy. In RGB, tinting a garment shifts its brightness along with its hue, and you fight the cross-channel coupling the whole time. In LAB, the L channel is independent of A and B - you can recolor a garment (A/B) while keeping its shading (L) untouched, or remap the lightness of one region to match another region's lighting, then hand the result back to this node to get a normal image again. The pack's whole recolor family (tri3d-recolor-mask-LAB_space, tri3d-luminosity-match) is built on that split-and-merge pattern.
Inputs
input_L,input_A,input_B- three MASKs (single-channel), the output ofRGB_2_LABor any node that produces a LAB channel. All three must be the same resolution and batch size.
Output
One IMAGE, labeled Output RGB image. The rebuilt frame, ready for preview or further processing.
The sharp edges
- Resolution and batch size must match across all three channels. The node checks and, on mismatch, prints an error to the console and silently drops the frame - you get fewer images out than you put in, with no exception thrown. If your output suddenly has a missing frame, check that all three channels have identical shapes. This is the #1 trap.
- The channels are plain 0–255 grayscale values passed to OpenCV's LAB converter. If you've normalized a channel to 0–1 or stretched it somewhere in between, the reconstruction will be color-shifted. Keep the channels in their native range through the round trip.
- It loops over the batch, so a batch in means a batch out - but again, only if every channel has the same batch length.
Install
Same pack, same routine:
cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
# restart ComfyUI
Or ComfyUI Manager (search "tri3d"). Keep the folder name tri3d-comfyui-nodes. OpenCV only - no model, no extra deps.
For LAB-space work, this node is the exit door you must walk through to get back to RGB. The missing-frame-on-mismatch behavior is annoying, but it's the only real wart - otherwise it's a faithful, boring converter that does exactly what the round trip needs.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_L | MASK | — | |
| input_A | MASK | — | |
| input_B | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Output RGB image | IMAGE | — |