ComfyUI Node

Darken (HSV)

Shade it down without draining the color

By maludwig·Created 2 years ago·Updated about a year ago· 6
Darken (HSV)
  • image
  • mask_opt
  • image
masked_areatrue
factor0.5

Darken (HSL) works fine, but it has a side effect: darkening toward lightness in HSL drags colors toward black, so a green hill darkens into a muddy, desaturated hill. Darken (HSV) is the version that keeps the color. It subtracts from the value channel of an HSV conversion instead, which shades the image down while preserving hue and saturation - your green hill stays green, just darker. When you want "night, but you can still tell what color everything is," this is the node to grab from the Basix Image Filters pack.

How it works

Image in, convert to HSV, subtract the factor from the value channel, clamp, convert back to RGB. That's it. The difference from HSL is the whole story of this pack: HSV's value is "how bright is the color," HSL's lightness is "how close to white." So in HSV, darkening keeps a color saturated as it dims - a bright green becomes a deep, rich green rather than turning gray-green on its way to black. The README's comparison image shows both side by side, and once you see it, you'll never pick the wrong one again.

The inputs that matter

  • image - any IMAGE tensor.
  • factor (default 0.5, range −1 to 1) - the amount subtracted from value. 0 is no change. 0.5 drops pure white to 50% gray while keeping color intact. 1 makes everything black. Negative values brighten instead.
  • masked_area + optional mask_opt - the pack's standard masking.

Output is a single image tensor, same dimensions as the input.

The gotcha to know

Same stale-description issue as its HSL sibling: the in-UI text says a factor of 0 gives black and 1 gives the original, which is backwards. The shipped code does value -= factor, so 0 is the original and 1 is black. Minor, but it'll confuse you for exactly as long as you trust it.

Also, keep in mind what this node won't do for you. Because it never touches saturation, shadows in an HSV-darkened image can hold onto a lot of color - a night scene can look "lit by colored moonlight" rather than black. If you actually want pitch-black, use the HSL version, or stack a Desaturate on top.

Installing it

ComfyUI Manager → search "Basix Image Filters" (repo basix_image_filters) → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/maludwig/basix_image_filters

Restart after. No models, no downloads, no fancy dependencies - pure torch math.

Using it well

The README's example is a haunted house that should glow in the night - dark, but you want the colors to stay recognizable so the "glowing" reads. HSV Darken at moderate factors (0.2–0.5) is ideal for that. And as with every node here, the pattern that makes it sing is the img2img hint: darken a reference, feed it back at 0.7–0.9 denoise, and the model matches the darker but still-colorful tone. Want only the sky darker? mask_opt + a MaskEditor mask, flip masked_area to choose inside or outside, done.

CategoryImage Filters

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
masked_areaBOOLEANtrue
factorFLOAT0.5-1–1
mask_optoptMASK

Outputs (1)

NameTypeDescription
imageIMAGE