Nodes/comfy_Pond_Nodes/🐳图像去色(V2)
ComfyUI Node

🐳图像去色(V2)

Dial in your own RGB weights for custom grayscale conversion

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳图像去色(V2)
  • image
  • 图像
R0.213
G0.715
B0.072
归一化true
去色强度1.00

Every grayscale conversion is secretly a weighted average of the red, green, and blue channels - and the weights you pick change the whole mood of the result. 🐳图像去色(V2) (DesaturateImageAdvanced) is the version of this pack's desaturate that lets you set those weights yourself. Instead of four fixed recipes, you get three sliders - R, G, B - and the node computes a custom luminance from them. It's the node for people who think about their B&W conversion, and it fixes the one thing the basic version can't.

The defaults are the giveaway that this is well-designed: R=0.2126, G=0.7152, B=0.0722. Those are the Rec.709 coefficients used in modern video - green gets 71.5% of the weight because the human eye is disproportionately sensitive to it. (Fun fact: the basic node's 亮度 preset uses these exact same coefficients, so the two nodes agree at default - the real difference is that this one lets you change them.) The node computes gray = R·red + G·green + B·blue per pixel, with a 归一化 (normalize) toggle that re-scales the weights to sum to 1 - so if you set all three to 1, you get the plain average, and if you set 1/0/0 you get the pure red channel as grayscale.

The controls

  • image - the input.
  • R / G / B - the three weight sliders, 0 to 1, step 0.001. This is the entire point of the node. Set R=1, G=0, B=0 for a red-channel extraction; keep the defaults for a faithful Rec.709 conversion; tweak toward R and away from B for warmer-feeling B&W.
  • 归一化 - boolean, default true. Normalizes the weights so they sum to 1. Leave it on unless you're deliberately going for an over/under-bright result.
  • 去色强度 - 0 to 1, default 1.0. Blends between the original color and your custom-converted gray. Below 1.0 it's a desaturation-with-taste, not full B&W.

Output

One IMAGE, in RGB. Same batch-safe behavior as the base node - every frame in the tensor gets the same conversion, so it's safe for video sequences.

Install

From comfy_Pond_Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Pondowner857/comfy_Pond_Nodes
cd comfy_Pond_Nodes && pip install -r requirements.txt

Pure numpy math, no models. Honest take: unless you have a specific channel-extraction or mood goal, the basic DesaturateImage's 亮度 preset gives you the same result with less thinking - Rec.709 and Rec.601 are close enough that you won't see the difference on most images. This V2 earns its keep when you want single-channel looks (R/G/B extraction for split-toning or texture passes) or a custom weight you'll reuse. For that narrow but real job, it's the right tool.

Category🐳Pond/颜色

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
RFLOAT0.2130–1
GFLOAT0.7150–1
BFLOAT0.0720–1
归一化BOOLEANtrue
去色强度FLOAT1.000–1

Outputs (1)

NameTypeDescription
图像IMAGE