Nodes/tri3d-comfyui-nodes/Convert to LAB color space v5.1.0
ComfyUI Node

Convert to LAB color space v5.1.0

Split an image into L, A, and B channels you can edit independently

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Convert to LAB color space v5.1.0
  • input_RGB_image
  • L
  • A
  • B

LAB is the color space you reach for when you want to edit lightness without wrecking the color, or shift the color without touching the lightness. Unlike RGB, where a brightness tweak drags all three channels along, LAB separates the job: L is pure lightness, A is the green–red axis, B is the blue–yellow axis. This node converts an RGB image into those three channels and hands each one to you as its own MASK output - ready to be edited, renormalized, or used as a lighting layer.

In this pack it's the front half of a color pipeline: split with RGB_2_LAB, tweak the L channel (the pack's renormalize_array and recolor nodes love a separated lightness layer), then merge back with the pack's LAB_2_RGB. It's also a great way to feed a depth-map-style lighting layer to something that expects a single channel.

How it works

Plain OpenCV: cv2.cvtColor(..., COLOR_RGB2LAB) per frame, then the three result channels are sliced out and converted back to ComfyUI masks. The batch dimension is preserved - if you feed N frames, you get N L, A, and B masks each. The output masks are single-channel float tensors, which is why they come out as MASK rather than IMAGE.

The inputs that matter

  • input_RGB_image (IMAGE) - the only input.

Outputs:

  • L (MASK) - lightness. Edit this for brightness/contrast without hue shifts.
  • A (MASK) - green–red axis. Push toward red or green.
  • B (MASK) - blue–yellow axis.

All three share the source's resolution, so they re-stack cleanly in LAB_2_RGB.

Installing it

Same pack, one install:

cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
cd tri3d-comfyui-nodes
pip install -r requirements.txt

or ComfyUI Manager → "tri3d-comfyui-nodes", restart, under TRI3D.

Common issues

  • Forgetting the merge node - L/A/B masks are intermediate data. Without the pack's LAB_2_RGB on the other end you'll be stuck staring at grey channels. Build the split/edit/merge chain up front.
  • Edits outside the valid range - LAB values have specific ranges (L up to 255, A/B roughly -127 to +127 after conversion), and clipping happens silently. Heavy edits can clip and look washed out.
  • It's not HSL/HSV - a common swap. HSL's "L" is a different beast. If you wanted hue/saturation control, the pack's HSV recolor node is the one.

It's a plumbing node - you won't gush about it, but the color pipelines in this pack and beyond are built on exactly this kind of split.

CategoryTRI3D

Inputs (1)

NameTypeDefaultDescription
input_RGB_imageIMAGE

Outputs (3)

NameTypeDescription
LMASK
AMASK
BMASK