Nodes/ComfyUI-Image-Effects/๐ŸŒ— Shadow/Highlight
ComfyUI Node

๐ŸŒ— Shadow/Highlight

Pull Detail Out of Crushed Shadows and Blown Highlights Without Touching Midtones

By orion4dยทCreated about a year agoยทUpdated about a year agoยท 28
๐ŸŒ— Shadow/Highlight
  • image
  • IMAGE
โ—„shadow_amount0โ–บ
โ—„highlight_amount0โ–บ
โ—„shadow_width50โ–บ
โ—„highlight_width50โ–บ
โ—„radius30โ–บ

If you've ever rendered something with a sky that's pure white or a subject hiding in a black hole of shadow, this is the node you wanted. Shadow/Highlight is the Photoshop/Lightroom trick of brightening dark regions and darkening bright regions without running a global contrast slider over the whole image. Where "levels" and "curves" remap every pixel, this one only moves the ends - your midtones get to stay put.

It's a post-process, so it slots in after the VAE decode and before Save Image, usually at the very end of your graph. ComfyUI has plenty of ways to lighten an image, but most of them wreck the overall feel while they're at it. This is the one that fixes exposure selectively.

How it works

The node computes luminance for every pixel, then builds two soft masks. Anything darker than your shadow_width threshold becomes part of a "shadow mask"; anything brighter than 1 - highlight_width becomes a "highlight mask". Each mask is blurred with a Gaussian (the radius input) so the effect feathers instead of hard-banding, then it's applied as a gentle multiplicative correction.

The whole thing runs in NumPy on the CPU, and the math is dead simple: shadow_factor = 1 + shadow_amount/100. Dial shadow_amount to 40 and shadow pixels get multiplied by 1.4 - but only the shadow pixels, with a smooth transition. Negative values push the opposite way if you want to crush blacks back down.

The inputs that matter

  • shadow_amount / highlight_amount (โˆ’100 to 100) - the two real controls. Positive lightens shadows / darkens highlights. Start at 10โ€“20; this effect gets ugly fast past 50.
  • shadow_width / highlight_width (0โ€“100, default 50) - how much of the tonal range counts as "shadow" or "highlight". Wider = the correction reaches further into the midtones.
  • radius (0โ€“100, default 30) - softens the mask edges. Leave it on unless you want visible halos.

The single output is the corrected IMAGE, which feeds straight into a Preview or Save node.

Installing it

This node ships in ComfyUI-Image-Effects, a 32-node pack of classic effects by Orion4D. Easiest path is ComfyUI Manager โ†’ "Install Custom Nodes" โ†’ search "Image Effects". Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI-Image-Effects
cd ComfyUI-Image-Effects
pip install -r requirements.txt

Restart ComfyUI and the node appears under Add Node โ†’ Image Effects. No model files, no API keys - just NumPy, OpenCV, Pillow and SciPy on top of the torch ComfyUI already has.

Gotchas

Two things that bite everyone with this pack. First, every node here - this one included - processes only the first image in a batch. Feed it a frame stack and you get frame 0 back, silently. Second, it's CPU-bound NumPy, so on a big 4K image the blur is a little slow; that's why it belongs at the end of the graph, not in the middle of a loop. And don't chase perfection on the amount sliders - Shadow/Highlight is one of those effects where 15% looks great and 60% looks like an HDR disaster.

CategoryImage Effects

Inputs (6)

NameTypeDefaultDescription
imageIMAGEโ€”
shadow_amountFLOAT0-100โ€“100โ€”
highlight_amountFLOAT0-100โ€“100โ€”
shadow_widthFLOAT500โ€“100โ€”
highlight_widthFLOAT500โ€“100โ€”
radiusFLOAT300โ€“100โ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”