Nodes/ComfyUI_yanc/๐Ÿ˜ผ> Light Source Mask
ComfyUI Node

๐Ÿ˜ผ> Light Source Mask

Turn an image's bright spots into a soft mask

By ALatentPlaceยทCreated 2 years agoยทUpdated 2 years agoยท 80
๐Ÿ˜ผ> Light Source Mask
  • image
  • mask
โ—„threshold0.33โ–บ

If you've ever wanted to relight, bloom, or color-grade just the lamps and windows in a shot without hand-painting a mask, this is the node for it. It finds the brightest parts of an image on its own and hands you back a mask of them - already softened, ready to use.

How it works

You give it an image and a threshold; anything brighter than that cutoff gets pulled into the mask, and the result comes out pre-blurred rather than hard-edged, because a crisp cutout of "everything above X brightness" looks nothing like how a real light source actually glows. The blur is deliberate - don't fight it expecting a clean, binary selection.

This node's real value shows up feeding other nodes in the same pack. Wire its mask output into Brightness, Contrast, Saturation, Blur or Sharpen's mask_opt input and you're relighting or refining exactly the parts of the image that are already glowing - punch up brightness on a lamp, add bloom-adjacent contrast to a sunset, sharpen just the practical lights in a night scene. Or run it through Mask Curves, also in this pack, to sculpt the tonal falloff before using it in a composite.

The inputs and outputs that matter

  • image (IMAGE) - required.
  • threshold (FLOAT, 0โ€“1, step 0.01, default 0.33) - the brightness cutoff. Lower catches more of the midtones as "light," higher isolates only the truly blown-out areas.
  • mask (MASK) out - feed it into any maskable node, in this pack or elsewhere.

How to install it

Via ComfyUI Manager: search "yanc" or "ComfyUI_yanc" and install, then restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc

then restart ComfyUI. No extra dependencies or model downloads.

Common issues & troubleshooting

The mask covers almost the entire image. On a globally bright or overexposed shot, the default threshold of 0.33 can catch nearly everything. Raise it until only the actual light sources remain.

The mask is empty or nearly empty. The opposite problem on a dark, moody image with one small light source - the default might not catch it. Lower the threshold.

The mask edges look soft and feathered when you expected something crisp. That's intentional, not a bug - a hard-edged mask of "bright pixels" looks unnatural once you use it for relighting or compositing. If you genuinely need a binary mask, run this node's output through Mask Curves and push the high-value factor up to force it closer to solid black-and-white.

You want to relight the light sources themselves, not just brighten around them. Remember this node only produces a mask - it doesn't do any relighting on its own. You still need to wire that mask into an actual adjustment node (Brightness, Contrast, Bloom via a manual composite) to see any visible change.

CategoryYANC/๐Ÿ˜ผ Masking

Inputs (2)

NameTypeDefaultDescription
imageIMAGEโ€”
thresholdFLOAT0.330โ€“1โ€”

Outputs (1)

NameTypeDescription
maskMASKโ€”