LayerMask: Shadow Highlight Mask V2
Luminosity masks for shadows and highlights
- image
- mask
- shadow_mask
- highlight_mask
This node hands you two masks from a single image: one for the shadows, one for the highlights. If you've ever done "luminosity masking" in Photoshop - selecting the darks or the brights so you can grade them independently - that's exactly this, as a node. It's the foundation for selective color work: warm up just the highlights, lift just the shadows, do a proper split-tone, or dodge and burn without touching the midtones.
It's a grading tool, not a cutout tool. You reach for it when you want to push tone into part of the brightness range rather than the whole image. Feed the shadow mask into one color adjustment and the highlight mask into another, and you're grading like a colorist instead of nudging global sliders.
How it works
It reads the image's luminance and builds two masks by range: pixels in the dark end become the shadow mask, pixels in the bright end become the highlight mask, each with a soft falloff so the selections blend rather than clip. The range controls set how wide each grab is, and the level_offset controls shift where the threshold sits.
The inputs and outputs that matter
image(IMAGE) - the source to analyze.shadow_range(FLOAT, 0.01–0.99, default 0.25) - how much of the dark end counts as shadow. Wider grabs more midtone.highlight_range(FLOAT, 0.01–0.99, default 0.25) - same, for the bright end.shadow_level_offset/highlight_level_offset(INT, −99 to 99, default 0) - shift each threshold up or down to fine-tune what gets included.mask(optional MASK) - constrain the whole thing to a region, so you only pull shadows/highlights from, say, the subject.
Two outputs: shadow_mask (MASK) and highlight_mask (MASK). Route each into its own downstream adjustment.
How to install it
ComfyUI Manager → search ComfyUI Layer Style → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
Restart to install requirements. No model download for this one.
Common issues & troubleshooting
If it's not in the menu, that's the pack-wide IMPORT FAILED issue - ComfyUI_LayerStyle failing to load. Check the startup log. Across this pack the usual causes: a stale install from before it split into ComfyUI_LayerStyle and ComfyUI_LayerStyle_Advanced (delete and reinstall), or a broken dependency crashing the import. Reinstall clean via Manager.
On use: if the shadow and highlight masks overlap heavily in the midtones, narrow both range values so each selection stays at its end of the histogram. If a mask is grabbing too much or too little, the level_offset is your fine adjustment. Preview the masks before you grade - it's much easier to see you've selected the wrong tones as a black-and-white mask than to chase it in the final colored result. And this is the "V2" for a reason; if you're following an old workflow that references a plain ShadowHighlightMask, this refined version is the one to use.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| shadow_level_offset | INT | 0-99–99 | — |
| shadow_range | FLOAT | 0.250.01–0.99 | — |
| highlight_level_offset | INT | 0-99–99 | — |
| highlight_range | FLOAT | 0.250.01–0.99 | — |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| shadow_mask | MASK | — |
| highlight_mask | MASK | — |