Nodes/ComfyUI-BrainDead/BD Mask Color Fill
ComfyUI Node

BD Mask Color Fill

Fill up to 4 mask regions with flat colors and composite them over an optional background. Slots are layered 1 (bottom) → 4 (top). Overlapping regions are painted by the higher-numbered slot. Each slot has independent expand (dilate) and feather (blur) so you can grow and soften each zone separately. bg_alpha_from_image: when ON and a background image is connected, the background image's luminance drives the RGBA alpha channel — white areas of the background become opaque, black areas transparent. Use this when your background is a head/body shape cutout. Plug BD_FaceSocketInfill mask outputs here to build flat-color UV textures for 2D flipbook animation.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
BD Mask Color Fill
  • background
  • bg_mask
  • mask_1
  • mask_2
  • mask_3
  • mask_4
  • image
  • rgba
  • mask
  • status
bg_r0
bg_g0
bg_b0
bg_alpha0.00
bg_alpha_from_imagefalse
bg_alpha_invertfalse
r_1255
g_10
b_10
expand_10
feather_10
r_20
g_2255
b_20
expand_20
feather_20
r_30
g_30
b_3255
expand_30
feather_30
r_4255
g_4255
b_40
expand_40
feather_40
Category🧠BrainDead/Segmentation

Inputs (32)

NameTypeDefaultDescription
backgroundoptIMAGEBase image. If not connected, bg_r/g/b solid color is used as background.
bg_roptINT00–255Background red (used when no background image).
bg_goptINT00–255Background green.
bg_boptINT00–255Background blue.
bg_alphaoptFLOAT0.000–1Alpha of the background in the RGBA output. 0 = transparent background (default). 1 = fully opaque.
bg_maskoptMASKClip mask applied AFTER all slot painting. Uses ComfyUI mask convention: 1.0 (white) = keep/opaque, 0.0 (black) = transparent. Wire your head silhouette mask here — areas outside the head (mask=0) become transparent even if a slot bleeds there. This is the recommended way to clip by head shape. bg_alpha controls the non-slot base: 0=only slot zones show, 1=whole masked region is opaque showing background pixels.
bg_alpha_from_imageoptBOOLEANfalseWhen ON and a background image is connected, the background image's luminance is also used as a clip (in addition to bg_mask if wired). White=opaque, black=transparent. Enable bg_alpha_invert if your background image has the opposite convention (white=background, dark=head).
bg_alpha_invertoptBOOLEANfalseInvert the bg_alpha_from_image clip. Use when your background image has white=background (to be clipped out) and dark=head (to be kept). Has no effect when bg_alpha_from_image is OFF.
mask_1optMASKMask slot 1. Leave unconnected to skip.
r_1optINT2550–255Red channel for slot 1.
g_1optINT00–255Green channel for slot 1.
b_1optINT00–255Blue channel for slot 1.
expand_1optINT00–60Dilate mask slot 1 by this many pixels before coloring. Grows the painted region outward.
feather_1optINT0-200–200Edge feather for mask slot 1. Applied after expand. Positive: soft ramp extends OUTWARD from the fill edge — interior stays fully opaque, only the boundary bleeds out. Negative: soft ramp goes INWARD — fill fades toward its own edge. 0 = hard binary edge.
mask_2optMASKMask slot 2. Leave unconnected to skip.
r_2optINT00–255Red channel for slot 2.
g_2optINT2550–255Green channel for slot 2.
b_2optINT00–255Blue channel for slot 2.
expand_2optINT00–60Dilate mask slot 2 by this many pixels before coloring. Grows the painted region outward.
feather_2optINT0-200–200Edge feather for mask slot 2. Applied after expand. Positive: soft ramp extends OUTWARD from the fill edge — interior stays fully opaque, only the boundary bleeds out. Negative: soft ramp goes INWARD — fill fades toward its own edge. 0 = hard binary edge.
mask_3optMASKMask slot 3. Leave unconnected to skip.
r_3optINT00–255Red channel for slot 3.
g_3optINT00–255Green channel for slot 3.
b_3optINT2550–255Blue channel for slot 3.
expand_3optINT00–60Dilate mask slot 3 by this many pixels before coloring. Grows the painted region outward.
feather_3optINT0-200–200Edge feather for mask slot 3. Applied after expand. Positive: soft ramp extends OUTWARD from the fill edge — interior stays fully opaque, only the boundary bleeds out. Negative: soft ramp goes INWARD — fill fades toward its own edge. 0 = hard binary edge.
mask_4optMASKMask slot 4. Leave unconnected to skip.
r_4optINT2550–255Red channel for slot 4.
g_4optINT2550–255Green channel for slot 4.
b_4optINT00–255Blue channel for slot 4.
expand_4optINT00–60Dilate mask slot 4 by this many pixels before coloring. Grows the painted region outward.
feather_4optINT0-200–200Edge feather for mask slot 4. Applied after expand. Positive: soft ramp extends OUTWARD from the fill edge — interior stays fully opaque, only the boundary bleeds out. Negative: soft ramp goes INWARD — fill fades toward its own edge. 0 = hard binary edge.

Outputs (4)

NameTypeDescription
imageIMAGERGB composite.
rgbaIMAGERGBA — filled regions opaque, background transparent (unless bg_alpha > 0).
maskMASKUnion of all active mask slots.
statusSTRING