Nodes/ComfyUI Essentials/πŸ”§ Image Desaturate
ComfyUI Node Runs on cloud

πŸ”§ Image Desaturate

Proper grayscale with a choice of luminance formula

By cubiqΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,152
πŸ”§ Image Desaturate
  • image
  • IMAGE
β—„factor1.00β–Ί
β—„methodβ–Ύβ–Ί

Turning an image black-and-white sounds trivial until you realize there are several right ways to do it and they don't look the same. Averaging the R, G, and B channels is the naive one and it looks flat because human eyes weight green far more than blue. ImageDesaturate lets you pick the desaturation method - including the perceptually correct luminance weightings - and dial in how much to desaturate, so you can go full grayscale or just pull some color out.

It's from ComfyUI Essentials by cubiq (Matteo Spinelli, the ComfyUI_IPAdapter_plus author), and it's a good example of the pack's habit of taking a "simple" operation and exposing the parameter that actually matters.

How it works

Each method converts color to a single brightness value in a different way, then the result is blended back toward the original by the factor. The luminance methods weight the channels the way the eye perceives them (green heaviest, blue lightest), which is why they keep the tonal relationships that a plain average flattens.

The inputs and outputs that matter

  • image (IMAGE) - the input.
  • method - the important choice, four options: luminance (Rec.709), luminance (Rec.601), average, lightness. Rec.709 is the modern HD-video standard and a safe default; Rec.601 is the older SD-video weighting; average is the naive flat one; lightness uses the HSL lightness channel. For most work, Rec.709 is the one to reach for.
  • factor (FLOAT, 0–1, default 1) - how far to desaturate. 1 is fully gray; 0 leaves the image untouched; values in between give a muted, partially-desaturated look that's great for stylizing without going full monochrome.

Output: a single IMAGE.

How to install it

ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
pip install -r ComfyUI_essentials/requirements.txt

then restart. No models.

Common issues & troubleshooting

My grayscale looks flat and lifeless. You're probably on average. Switch to luminance (Rec.709) - it preserves the perceived brightness of colored areas (a saturated red and a saturated blue that read as different tones stay different), where averaging collapses them.

I wanted a luminance mask, not a gray picture. This node outputs an image, not a mask. If you're after a mask to drive compositing or inpainting, convert the desaturated image to a mask downstream - but note that a full-desaturate here is a clean way to get a luminance map first.

It didn't fully remove the color. Check factor. Below 1 it's an intentional partial desaturation. Set it to 1 for true grayscale.

Node missing after updating ComfyUI. Essentials is maintenance-only as of April 2025 and pack nodes have broken on newer builds. Update through Manager; if it's genuinely incompatible, a rollback is the usual workaround - though this operation is simple enough that other packs cover it too.

Categoryessentials/image processing

Inputs (3)

NameTypeDefaultDescription
imageIMAGEβ€”
factorFLOAT1.000–1β€”
methodCOMBO4 options: luminance (Rec.709), luminance (Rec.601), average, lightness

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”