Color Components Extract (MD)
Extract any color component as a mask — the most underrated node in this pack
- image
- mask
- mask
Here's the sleeper hit of the MdColorMod pack. Every other node in this collection takes an image and gives you a corrected image. mdColorCompExtract is the odd one out: it takes an image and gives you a mask. Specifically, it pulls a single color component - "RGB red", "Hue", "HSV value", "CMYK yellow", "LAB L", and about fifteen more - out of your image and returns it as a MASK tensor.
Why that's so useful
Masks are the plumbing that make selective edits work, and color components are a cheap, deterministic way to get them without training a detector. Say you generated a shot with a red dress and you want to regrade just the dress. Run the red-channel extraction, threshold it, and you have a region mask that follows the dress - no SAM, no GroundingDINO, no prompt needed. That's exactly the "you can get that mask in SO many ways" principle from our masking notes: a color separation is a legitimate and often faster way to build one.
It's also the honest way to feed the rest of the color nodes in this pack. mdColorCompExtract outputs a MASK, and every MdColorMod node accepts a mask - so "extract the hue mask, run it through a hue shift, blend" is a coherent pipeline entirely inside one pack.
The inputs
- image - required.
- Component - the dropdown with 21 choices. The useful families: RGB (red/green/blue), HSV (hue, saturation, value), HSL, CMYK, Y'CbCr, CIE LAB (L, a, b) and LCH (C, H), and Alpha. Pick the one that isolates what you're after - hue for anything "is this the same color" shaped, value for brightness isolation, alpha if you want to manipulate transparency.
- Invert - flips the mask. Trivial, but it's the difference between "grade the dress" and "grade everything but the dress."
- Linear - converts to linear light before extraction. For sRGB inputs this is the physically-correct option when you're extracting a luminance-ish component; leave it off for a more direct, punchy separation.
- Output: mask (MASK type, not IMAGE).
Notes and gotchas
Component extraction is deterministic and instant, which is the whole point of the post-processing layer - this is the "don't burn a model pass to find a region" move. Two things to know: a raw component mask is continuous (0-1 gradients), so pair it with a threshold or levels node if you need a hard selection; and on the Hue component, expect noise in low-saturation areas - hue is meaningless on gray pixels, so those regions will be garbage you'll want to mask out. That's physics, not a bug.
Installing
Standard for the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
or ComfyUI Manager → "MdColorMod", then restart. No dependencies (empty requirements.txt), pure torch, no model downloads, GPL-3.0. Young pack, so if Manager can't find it, clone manually.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor. | |
| Component | COMBO | RGB red | Which component to extract. |
| Invert | BOOLEAN | false | Invert the extracted mask. |
| Linear | BOOLEAN | false | Convert to linear before extraction (for sRGB inputs). |
| maskopt | MASK | Optional mask to restrict the extraction area. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | The extracted mask. |