Nodes/ComfyUI-BadmanNodes/LABColorTransfer(Badman)
ComfyUI Node

LABColorTransfer(Badman)

Push an image toward a target color in LAB space

By MariusKM·Created 2 years ago·Updated 3 months ago· 4
LABColorTransfer(Badman)
  • input_image
  • mask
  • IMAGE
hex_color0
method
preserve_details0.5
mask_threshold0.05

Color grading in RGB is a pain because shifting hue and shifting brightness aren't cleanly separable - nudge the red channel and you change luminance right along with it. LAB color space fixes that by splitting an image into lightness (L) and two color-only channels (A and B), so you can push color without dragging brightness around with it. That's the space this node works in.

What it's actually doing

Point the node at an input_image and a target color, and it shifts the image's color statistics toward that target in LAB space rather than just RGB. The mechanism you get to choose from is the method field, with four options: original, level_shift, histogram, and adaptive. The README doesn't spell out the exact math behind each, so the honest answer is that this is a "try each on your image" situation rather than one with an obvious default - but the naming gives you a reasonable map: histogram almost certainly does the strongest, most literal per-channel matching (the same idea as histogram color matching elsewhere in the pack - stronger, more palette-specific), while level_shift sounds like the gentler nudge of the four. preserve_details (0–1, default 0.5) is your dial for how much of the original's fine detail and contrast survives the shift versus how fully the target color takes over - push it toward 1 to keep texture intact, toward 0 to let the color transform dominate.

There's no separate reference-image input here - the target is a hex_color integer instead. If that field looks unfamiliar, it pairs neatly with this same pack's HexGenerator (Badman) node, which takes R/G/B sliders and outputs the packed integer this field expects. Dial in a color visually with three 0–1 sliders on HexGenerator, wire the INT output straight into hex_color, and you've got a color picker for this node without typing hex codes by hand.

Inputs and outputs

Required: input_image (IMAGE), hex_color (INT, the packed target color - pair with HexGenerator), method (enum: original / level_shift / histogram / adaptive), preserve_details (FLOAT, 0–1, default 0.5). Optional: mask (MASK) to restrict the effect to part of the image, and mask_threshold (FLOAT, 0–1, default 0.05) to control how strict that mask's cutoff is. One output: the transformed IMAGE.

Installing it

ComfyUI Manager: search ComfyUI-BadmanNodes, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MariusKM/ComfyUI-BadmanNodes

No extra dependencies or model downloads called out in the README for this node - it's array math on top of your existing image-processing stack, so it should install and run cleanly out of the box.

Where to be careful

Because there's no reference image, don't go in expecting classic "match this photo's palette to that photo's palette" behavior - that's a different tool (this pack's own Color Match node does exactly that job, learned from a reference pair). This one is "push toward a specific color," which is a narrower, more deliberate operation - better suited to a stylistic color-grade pass than to correcting color drift between two renders. If you're not seeing the effect you expect, check preserve_details first: at high values a subtle color target can get almost entirely absorbed by detail preservation, especially with the gentler method options. And if you're using the optional mask, remember mask_threshold is a cutoff, not a blend strength - a mask with a lot of soft, partial-value pixels near the threshold can produce a harder or softer effective boundary than the mask visually suggests, so it's worth checking the edge behavior on a test image before trusting it on a batch.

CategoryBadman

Inputs (6)

NameTypeDefaultDescription
input_imageIMAGE
hex_colorINT0
methodCOMBO4 options: original, level_shift, histogram, adaptive
preserve_detailsFLOAT0.50–1
maskoptMASK
mask_thresholdoptFLOAT0.050–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE