Extensions/ComfyUI-LABColorBlend
ComfyUI Extension

ComfyUI-LABColorBlend

A single ComfyUI node that recombines two images in CIE-LAB space: the L (lightness) channel comes from one image, the a/b (colour) channels come from another.

By villainsquad·Created about a month ago·Updated about a month ago· 0
villainsquad/ComfyUI-LABColorBlend
Nodes
On cloudLocal install
Stars0
Updatedabout a month ago
Readme

ComfyUI-LABColorBlend

A single ComfyUI node that recombines two images in CIE-LAB space: the L (lightness) channel comes from image_l, the a/b (colour) channels come from image_ab.

Install

cd custom_nodes/
git clone https://github.com/villainsquad/ComfyUI-LABColorBlend

Node: LAB Color Blend (L + a/b) (category: image/color)

| Input | Meaning | |-------|---------| | image_l | Source of the L (lightness/detail) channel. Output resolution follows this image. | | image_ab | Source of the a/b (colour) channels. Auto-resized to image_l. | | chroma_blend | 0 = keep image_l's own colour, 1 = fully image_ab's colour (default 1). | | chroma_scale | Saturation multiplier on the resulting a/b (default 1). | | backend | auto (kornia if present, else torch), kornia, or torch. |

Batch sizes are matched automatically (a batch of 1 broadcasts).

Node: LAB Blend & Save EXR / float-TIFF (category: image/color)

Blends and saves in one node, straight to a wide-gamut / high-bit-depth file. The result is written linear and unclamped in the chosen primaries, so nothing is clipped — out-of-gamut colours are preserved as out-of-range floats. It also returns an sRGB (clamped) preview image for the UI / chaining.

| Input | Meaning | |-------|---------| | image_l, image_ab, chroma_blend, chroma_scale, backend | Same as the blend node above. | | primaries | RGB primaries the file is encoded in: SRGB (= linear Rec.709, safest default), DISPLAY_P3, REC2020, PROPHOTO, ACESCG. | | file_format | EXR half (16-bit float, default), EXR float (32-bit), or TIFF float32. | | filename_prefix | Saved to the ComfyUI output dir; the primaries are appended to the filename. |

EXR writing tries imageio (FreeImage, auto-downloads once) then OpenCV (needs its OpenEXR codec enabled). TIFF float32 uses tifffile and always works with no extra setup. The file carries no embedded ICC/chromaticities tag — interpret it using the primaries recorded in the filename.

Which format for which "wide"?

| | 8-bit PNG | 16-bit PNG | float TIFF | OpenEXR | JPEG-XL / AVIF | |---|:-:|:-:|:-:|:-:|:-:| | Wide gamut (P3/Rec.2020/ProPhoto) | with ICC | ✅ with ICC | ✅ | ✅ | ✅ | | Values beyond 0..1 (HDR / unclamped) | ✗ | ✗ | ✅ | ✅ | ✅ (via PQ/HLG) |

16-bit PNG can hold a wide gamut (it's just precision + a profile) but not values beyond 0..1 — for the unclamped case you need float (EXR / float-TIFF) or an integer PQ/HLG format (AVIF/HEIF/JPEG-XL).

Speed / dependencies

  • Uses kornia for RGB↔LAB — already in ComfyUI's requirements.txt, runs on GPU. No extra install.
  • Falls back to a pure-torch implementation (D65 sRGB↔LAB) if kornia is absent — zero extra deps, still GPU-accelerated.
  • Round-trip conversion verified accurate to ~1e-6.