Nodes/ComfyUI-SBTools/Match Luminance (SBTools)
ComfyUI Node

Match Luminance (SBTools)

Hand one image's brightness to another

By Amatsukast·Created 5 months ago·Updated 21 days ago· 2
Match Luminance (SBTools)
  • target_image
  • target_alpha
  • reference_image
  • reference_alpha
  • IMAGE
  • RGB
  • ALPHA
strength1.00

Somewhere between "match everything" and "match the color cast" there's a quieter, more common problem: one image is just darker than the other, or flatter, or has its highlights in the wrong place. Match Luminance fixes exactly that. It's the third and simplest member of this pack's Match trio - Match Color does the full color distribution, Match Color Balance does temperature and tint, and this one does brightness alone.

It's the node you reach for when the colors already agree and the frames still don't sit together. Composite a dark cutout onto a bright scene and it reads as pasted-on; run it through this and the subject finally belongs. It's also a useful normalization step before feeding multiple images into a batch or an upscale - if every input has the same lightness, later processing treats them consistently.

How it works

There's not much machinery here, and that's a feature. The node takes the luminance (brightness) structure of the target image and reshapes it to match the reference image's lightness statistics, in the usual strength-controlled fashion. Unlike Match Color Balance, there's no Lab a/b channel work and no color-space choice - luminance only, which is why it has just two real settings instead of a control panel.

The core inputs are:

  • target_image - the image to correct.
  • reference_image - the image whose luminance gets matched. Same rule as its siblings: required. Forget it and the node errors out immediately.
  • strength (0–5, default 1) - 0 is no change, 1 is a full match, above 1 overcorrects. Brightness matching is easier to overdo than color matching, so 0.5–0.8 is often the sweet spot.

Optional target_alpha and reference_alpha MASK inputs let you compute the statistics over only a masked region - handy when, say, a bright window in the reference would otherwise skew everything.

Outputs are IMAGE (the matched result), plus the split RGB and ALPHA channels, same as the other Match nodes.

Installing it

Same pack, same install. ComfyUI Manager → search "ComfyUI-SBTools" → Install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Amatsukast/ComfyUI-SBTools.git
cd ComfyUI-SBTools
pip install -r requirements.txt

Restart ComfyUI after, and you're done. Nothing model-related to download here - this one's pure math on the pixels.

Troubleshooting

  • "reference_image is required" - the family habit. Wire a reference in before anything else.
  • Subject gets washed out - strength too high. Brightness matching at full strength can crush the target's own character; pull it under 1.
  • Nothing changes - check that the reference and target actually differ in lightness. If the reference is already the same brightness, there's nothing to match.
  • Only part of the image should change - feed target_alpha a mask and the statistics adapt.

It's a thin node, and the README marks it "in development" like its siblings. But for the specific thing it does - making one image's light match another's - it's one of those quiet tools you forget exists until you composite two shots and think, "ugh, why does this look off," and it fixes it in one wire.

CategorySBTools/Image

Inputs (5)

NameTypeDefaultDescription
target_imageIMAGEImage to be luminance matched (RGB or RGBA).
strengthFLOAT1.000–5Luminance matching strength (0=no change, 1=full match, >1=overcorrection).
target_alphaoptMASKOptional alpha channel for target image (overrides target_image 4th channel if present).
reference_imageoptIMAGEReference image for luminance (RGB only, alpha channel is ignored).
reference_alphaoptMASKOptional alpha channel for reference image (overrides reference_image 4th channel if present).

Outputs (3)

NameTypeDescription
IMAGEIMAGE
RGBIMAGE
ALPHAMASK