Nodes/MdColorMod/Color Shadows-Highlights (MD)
ComfyUI Node

Color Shadows-Highlights (MD)

The shadow-rescue node that actually works locally

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Shadows-Highlights (MD)
  • image
  • mask
  • image
Shadows0.0
Shadows_color_adj100.0
Highlights0.0
Highlights_color_adj50.0
White_point_adj0.000
Radius100.0
Compress0.0

This is the node you reach for when the model crushed your blacks or blew out your highlights and you don't want to re-roll the seed. mdColorShadowsHighlights pulls detail back out of shadow and highlight regions locally - it looks at each pixel's neighborhood, decides whether it's in a shadow or a highlight, and lifts or darkens accordingly. That's a fundamentally smarter operation than a global brightness slider, which is why this is arguably the most useful node in the MdColorMod pack.

How it works

It's a faithful port of GIMP's GEGL shadows-highlights filter. The recipe, roughly:

  1. Compute Rec.709 luminance (0.2126 R + 0.7152 G + 0.0722 B).
  2. Blur that luminance to get a local context - a blurred version of the image tells you whether any given pixel sits in a bright or dark neighborhood.
  3. Weight shadows with (1 - local)¹·⁵ and highlights with local¹·⁵, so the brightening and darkening apply where they should and roll off smoothly elsewhere.
  4. Apply a midtone-preserving compression so you don't blow everything out, then rebalance color saturation in the shadow and highlight zones separately.

Because it works on local blur rather than the whole frame, you get real detail recovery - the face in the dark corner, the texture in the white sky - instead of a flat lift.

The inputs that matter

  • Shadows - -100 to 100, default 0. Positive lightens shadows.
  • Highlights - -100 to 100, default 0. Positive darkens highlights.
  • Radius - 0.1 to 1500, default 100. How big a "neighborhood" counts as local. This is the one beginners mishandle: too small and you get micro-contrast noise, too large and the effect stops being local at all.
  • Compress - 0 to 100. Protects midtones from clipping. Crank it if your result is blowing out.
  • White_point_adj - a small overall brightness nudge, useful after heavy lifting.
  • Shadows_color_adj / Highlights_color_adj - how much saturation is re-added in each zone (defaults 100 and 50). Drop these if the recovery looks color-washed.
  • mask - optional, restrict the whole operation to a region.

Output is a single image, wire it to Preview/Save.

Install

Standard MdColorMod install, no dependencies, no models:

cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod

Restart ComfyUI, or search "MdColorMod" in ComfyUI Manager. All the color nodes land under the md menu.

Where people get burned

Two classic mistakes. First, halos: a Radius too large for the detail in your image makes the brightening bleed across edges and leaves a glowing fringe - drop the radius and the halo follows. Second, over-lifting: Shadows at +100 plus no compression turns a moody render into a flat, gray pancake. Work in increments of 20–30 and keep Compress above 30 if you pushed the sliders hard. And remember this is deterministic - same inputs, same output, no seed lottery.

Categorymd/image/color

Inputs (9)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
ShadowsFLOAT0.0-100–100Amount to lighten shadows (-100 to 100).
Shadows_color_adjFLOAT100.00–100Color adjustment strength for shadow areas (0-100).
HighlightsFLOAT0.0-100–100Amount to darken highlights (-100 to 100).
Highlights_color_adjFLOAT50.00–100Color adjustment strength for highlight areas (0-100).
White_point_adjFLOAT0.000-10–10White point adjustment to control overall brightness.
RadiusFLOAT100.00.1–1500Radius of the local area used for detection (higher = broader effect).
CompressFLOAT0.00–100Compression strength to prevent clipping (0-100).
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe adjusted image.