Nodes/comfyui_bmad_nodes/Color Clip ADE20k
ComfyUI Node Runs on cloud

Color Clip ADE20k

Clip ADE20k segmentations by label

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
Color Clip ADE20k
  • image
  • IMAGE
targetTO_BLACK
complementTO_WHITE
class_nameperson, individual, someone, somebody, mortal, soul

If you've ever stared at an ADE20k semantic segmentation map and wondered which RGB triple belongs to "wall," this node is for you. Color Clip ADE20k is the class-aware sibling of the pack's Color Clip: instead of typing a color, you pick a class name from the 151-class ADE20k list - person, wall, sky, tree, car - and it clips that class out of the image, exactly like the plain version clips a color.

Same family, same workflow. The difference is entirely in how you choose the target.

What it does

ADE20k is the scene-understanding dataset behind a lot of segmentation models, and it ships with a fixed palette - each semantic class has a canonical color. The pack's version (via the gray2color library) builds a dictionary mapping every ADE20k class name to its palette color. When you select class_name, the node looks up the color and runs the same clip logic as Color Clip against it.

Two practical details separate it from the basic node:

  • A small tolerance. The palette colors are close together - the author notes the max Euclidean distance between any two dictionary colors is ~7, with typical differences like (4,5,3) - so the node clips with a per-channel leeway of 2. That matters, because exact matching on a JPG'd segmentation map would leave speckles.
  • It's only useful for ADE20k-style images. The color it clips is the ADE20k palette color for that class. If your image isn't an ADE20k semantic map, this is the wrong tool - use plain Color Clip instead.

Inputs: image, target and complement (the same TO_BLACK / TO_WHITE / NOTHING enums), and class_name - a dropdown of the 151 classes with "person" as the default. Output is an IMAGE (a binary-ish matte if you set target to black and complement to white).

The catch: it needs gray2color

This is one of the pack's 📓 nodes - it depends on the external gray2color library. In practice ComfyUI Manager installs the pack's requirements.txt (which pins gray2color) automatically. If you cloned manually and skipped the requirements, the whole pack prints a "not loaded" note at startup and this node won't appear in your node list. The fix:

cd ComfyUI/custom_nodes/comfyui_bmad_nodes
pip install -r requirements.txt

then restart ComfyUI. As long as gray2color is importable you'll see the node.

Install

Full install, for the record:

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

or grab "comfyui_bmad_nodes" via ComfyUI Manager.

Where this pays off: pull a segmentation map out of a SAM or segmentation model, pick the class you care about, and you've got a clean subject mask without touching a color picker - one dropdown instead of RGB spelunking.

CategoryBmad/image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
targetCOMBOTO_BLACK3 options: TO_BLACK, TO_WHITE, NOTHING
complementCOMBOTO_WHITE3 options: TO_BLACK, TO_WHITE, NOTHING
class_nameCOMBOperson, individual, someone, somebody, mortal, soul151 options: None, wall, building, edifice, sky, floor, flooring, tree, +145

Outputs (1)

NameTypeDescription
IMAGEIMAGE