Mfc β‘π ‘π π £π
Pick a target color, get a mask
- image
- MASK
- IMAGE
The class name doesn't get explained anywhere the schema or the README surfaces, but going by what it actually does - pick a target color, get a mask - it reads like shorthand for "mask from color." This is old-school color-keying, the kind of thing you'd reach for with a green screen: give it an RGB value, and every pixel close enough to that value becomes white in the output mask, everything else black.
How it works
Four inputs, no chaining, no timing, nothing exotic. red, green, and blue (each 0β255) define the target color you want to key out - the defaults sit at 255, 255, 255, i.e. pure white, so out of the box it'll key near-white regions of your image. threshold (0β127) is the tolerance: how far a pixel's color can drift from the target and still count as a match. Zero means an exact match only, which in practice means almost nothing matches on real footage with any compression noise or lighting variation; nudge it up until the mask covers what you actually want without bleeding into neighboring colors.
Note the cap - threshold only goes to 127, not the full 0β255 range you might expect. That's roughly half of a color channel's range, so there's no "match everything" setting; it always stays a real color-proximity test, not a way to accidentally mask the whole frame.
Inputs and outputs
image(required,IMAGE) - the frame(s) to key.red/green/blue(0β255 each, default 255) - the target color.threshold(0β127, default 0) - color-matching tolerance.
Two outputs: MASK (the actual key result - white where the color matched) and IMAGE. The schema doesn't spell out what the image output shows beyond its type, so the first time you use it, run it once and look - most likely it's a visual copy of the match for quick previewing without wiring up a separate MaskToImage node, but confirm on your own footage rather than assuming.
How to install it
ComfyUI Manager: search "RyanOnTheInside", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt
then restart. Nothing model-related here - it's a straightforward per-pixel color comparison, so no downloads and no dependency drama specific to this node.
Common issues & troubleshooting
Mask is empty at the defaults. If your source footage doesn't have much pure white in it, the default 255,255,255 target with threshold=0 will match essentially nothing. Set the RGB fields to a color that's actually in your frame (sample it from your source image first) before assuming the node is broken.
Mask is too aggressive, catching things you didn't intend. Bring threshold back down - since it's a single tolerance radius around one target color, a high threshold on a busy, similarly-toned image will grab more than you meant. There's no per-channel tolerance here, so if you need tighter control on, say, green versus blue drift specifically, you'll want a different node - this one treats the tolerance as one number across all three channels.
Trying to key a moving/shifting color (skin tone under changing light, for example). This node has no adaptive or per-frame recalibration - it's a fixed target color for the whole run. If your subject's color shifts meaningfully across the sequence, a single static target will inevitably miss frames at one end or the other.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image to create mask from (IMAGE type) | |
| red | INT | 2550β255 | Red component of target color (0 to 255) |
| green | INT | 2550β255 | Green component of target color (0 to 255) |
| blue | INT | 2550β255 | Blue component of target color (0 to 255) |
| threshold | INT | 00β127 | Color matching tolerance (0 to 127) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | β |
| IMAGE | IMAGE | β |