Nodes/RyanOnTheInside/Mfc βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Mfc βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

Pick a target color, get a mask

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Mfc βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
  • image
  • MASK
  • IMAGE
β—„red255β–Ί
β—„green255β–Ί
β—„blue255β–Ί
β—„threshold0β–Ί

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.

CategoryRyanOnTheInside/Masks

Inputs (5)

NameTypeDefaultDescription
imageIMAGEInput image to create mask from (IMAGE type)
redINT2550–255Red component of target color (0 to 255)
greenINT2550–255Green component of target color (0 to 255)
blueINT2550–255Blue component of target color (0 to 255)
thresholdINT00–127Color matching tolerance (0 to 127)

Outputs (2)

NameTypeDescription
MASKMASKβ€”
IMAGEIMAGEβ€”