ComfyUI Node
Mask Tools (C2C)
Keyers and matte operations in one node: colour, luma and difference keys; grade (gain, gamma, clamp, invert); grow or shrink each side (left / right / up / down) with a feather; combine two mattes; gradient; grain; motion blur; edge spread; channel shuffle.
Mask Tools (C2C)
- image
- mask
- mask_b
- plate
- size_as
- mask
- image
- report
◄modekey: colour►
◄colour_key_color#FFFFFF►
◄colour_key_colorspacergb►
◄colour_key_tolerance50►
◄colour_key_soft_falloff10►
◄colour_key_invertfalse►
◄luma_key_modeauto►
◄luma_key_low0.00►
◄luma_key_high1.00►
◄luma_key_gamma1.00►
◄luma_key_falloff1.0►
◄luma_key_invertfalse►
◄luma_key_channelluma►
◄luma_key_low_soft0.00►
◄luma_key_high_soft0.00►
◄luma_key_invert_keyfalse►
◄difference_key_tolerance0.080►
◄difference_key_softness0.050►
◄difference_key_invertfalse►
◄grade_gain1.00►
◄grade_gamma1.00►
◄grade_clamptrue►
◄grade_invertfalse►
◄grow_left0►
◄grow_right0►
◄grow_up0►
◄grow_down0►
◄grow_feather0►
◄combine_opunion►
◄gradient_width512►
◄gradient_height512►
◄gradient_typelinear►
◄gradient_angle0.0►
◄gradient_center_x0.50►
◄gradient_center_y0.50►
◄gradient_start0.00►
◄gradient_end1.00►
◄grain_amount6►
◄grain_seed0►
◄grain_size4►
◄grain_invertfalse►
◄motion_blur_angle0.0►
◄motion_blur_distance20►
◄motion_blur_invertfalse►
◄edge_spread4►
◄edge_spread_invert_maskfalse►
◄shuffle_out_RR►
◄shuffle_out_GG►
◄shuffle_out_BB►
◄shuffle_out_AA►
◄shuffle_premultiply_outputfalse►
Category🐺 C2C/🧰 Core/Mask
Inputs (56)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | key: colour | What the node does. Each mode shows only its own controls. |
| colour_key_color | STRING | #FFFFFF | key: colour: Target colour as #RRGGBB — the hue you want to keep or remove. |
| colour_key_colorspace | COMBO | rgb | key: colour: Distance metric. LAB separates dark navy from dark brown; RGB treats them as similar luminance. |
| colour_key_tolerance | FLOAT | 500–100 | key: colour: How far a pixel's colour can drift from the pick and still count as a match. |
| colour_key_soft_falloff | FLOAT | 100–100 | key: colour: Graded band outside tolerance — stops a colour key from cutting like a pair of scissors. |
| colour_key_invert | BOOLEAN | false | key: colour: Swap matched and unmatched regions. |
| luma_key_mode | COMBO | auto | key: luma: Preset luminance range or custom thresholds. auto: Analyzes image brightness to pick best range. highlights: Keys bright regions (0.7–1.0). midtones: Keys mid-range luminance (0.3–0.7). shadows: Keys dark regions (0.0–0.3). custom: Uses the low/high sliders directly. |
| luma_key_low | FLOAT | 0.000–1 | key: luma: Low threshold – pixels with luminance below this become 0 in the mask. Only used directly in custom mode; presets override this. |
| luma_key_high | FLOAT | 1.000–1 | key: luma: High threshold – pixels with luminance above this become 1 in the mask. Only used directly in custom mode; presets override this. |
| luma_key_gamma | FLOAT | 1.000.01–10 | key: luma: Gamma correction applied after keying. >1 compresses mask toward black (reduces coverage). <1 expands mask toward white (increases coverage). |
| luma_key_falloff | FLOAT | 1.00–10 | key: luma: Smoothness of the transition between low and high thresholds. 0 = hard binary edge. 1 = standard smooth. >1 = very gradual transition. |
| luma_key_invert | BOOLEAN | false | key: luma: Invert the output mask (swap keyed and unkeyed regions). |
| luma_key_channel | COMBO | luma | key: luma: Channel to key on. Luma is BT.709; hue/sat/value and LAB a/b isolate coloured spill without three separate nodes. |
| luma_key_low_soft | FLOAT | 0.000–1 | key: luma: Blend-If split below low — ramp into the key instead of a hard cut that looks like a sticker. |
| luma_key_high_soft | FLOAT | 0.000–1 | key: luma: Blend-If split above high — feather the highlight side of the range. |
| luma_key_invert_key | BOOLEAN | false | key: luma: Invert the sampled channel before thresholding (ImageToMask behaviour). Distinct from invert, which flips the finished matte. |
| difference_key_tolerance | FLOAT | 0.0800–1 | key: difference: How far a pixel may differ from the clean plate and still count as background (0..1 of the RGB distance). |
| difference_key_softness | FLOAT | 0.0500–1 | key: difference: Width of the soft edge above the tolerance. |
| difference_key_invert | BOOLEAN | false | key: difference: Key the unchanged part instead of what changed. |
| grade_gain | FLOAT | 1.000–16 | grade: Multiply the matte (above 1 pushes greys toward white). |
| grade_gamma | FLOAT | 1.000.05–8 | grade: Bend the greys: above 1 lifts them, below 1 sinks them; black and white stay put. |
| grade_clamp | BOOLEAN | true | grade: Keep the result inside 0..1. |
| grade_invert | BOOLEAN | false | grade: Flip the matte at the end. |
| grow_left | INT | 0-4096–4096 | grow / shrink: Pixels to grow the matte toward the left (negative shrinks its left edge). |
| grow_right | INT | 0-4096–4096 | grow / shrink: Pixels to grow toward the right (negative shrinks its right edge). |
| grow_up | INT | 0-4096–4096 | grow / shrink: Pixels to grow upward (negative shrinks its top edge). |
| grow_down | INT | 0-4096–4096 | grow / shrink: Pixels to grow downward (negative shrinks its bottom edge). |
| grow_feather | INT | 00–1000 | grow / shrink: Soften the result by this blur radius in pixels. |
| combine_op | COMBO | union | combine |
| gradient_width | INT | 5124–16384 | gradient: Output width when size_as is not connected. |
| gradient_height | INT | 5124–16384 | gradient: Output height when size_as is not connected. |
| gradient_type | COMBO | linear | gradient: Ramp shape — linear edge fade, radial vignette, or angular wipe. |
| gradient_angle | FLOAT | 0.0-360–360 | gradient: Direction for linear, or rotation offset for angular ramps. |
| gradient_center_x | FLOAT | 0.500–1 | gradient: Radial/angular origin, normalised 0–1 across the frame. |
| gradient_center_y | FLOAT | 0.500–1 | gradient: Radial/angular origin, normalised 0–1 down the frame. |
| gradient_start | FLOAT | 0.000–1 | gradient: Mask value at the ramp start (black end). |
| gradient_end | FLOAT | 1.000–1 | gradient: Mask value at the ramp end (white end). |
| grain_amount | INT | 60–127 | grain: Noise strength — enough to hide banding, not enough to read as texture. |
| grain_seed | INT | 00–2147483647 | grain: Fixed seed holds the grain still through a sequence; upstream reseeded every frame and the matte crawled. |
| grain_size | INT | 41–64 | grain: Noise frequency — larger values give coarser, less speckly grain. |
| grain_invert | BOOLEAN | false | grain: Flip mask polarity before adding grain. |
| motion_blur_angle | FLOAT | 0.0-360–360 | motion blur: Blur direction in degrees, 0 = horizontal right. |
| motion_blur_distance | INT | 200–9999 | motion blur: Blur length in pixels along the angle. |
| motion_blur_invert | BOOLEAN | false | motion blur: Flip mask polarity before blurring. |
| edge_spread | INT | 40–9999 | edge spread: How many pixels to push inward colour outward — kills the dark fringe on a lighter background. |
| edge_spread_invert_mask | BOOLEAN | false | edge spread: Flip mask polarity when your matte is white-on-black. |
| shuffle_out_R | COMBO | R | shuffle |
| shuffle_out_G | COMBO | G | shuffle |
| shuffle_out_B | COMBO | B | shuffle |
| shuffle_out_A | COMBO | A | shuffle |
| shuffle_premultiply_output | BOOLEAN | false | shuffle |
| imageopt | IMAGE | keys, edge spread and shuffle: the picture to work on. | |
| maskopt | MASK | grade, grow / shrink, combine (first matte), grain, motion blur; edge spread's matte; gradient's size when nothing else gives one. | |
| mask_bopt | MASK | combine: the second matte. | |
| plateopt | IMAGE | key: difference - the clean plate (same shot, without the subject). | |
| size_asopt | IMAGE | gradient: take the size from this image. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| mask | MASK | The matte (shuffle: the new alpha; edge spread: the matte it used). |
| image | IMAGE | edge spread / shuffle: the processed picture. Other modes: the matte as a grey image, to look at. |
| report | STRING | What the node did, and anything worth knowing (clamped values, resized inputs). |