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.
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)
| Name | Type | Default | Description |
|---|---|---|---|
| backgroundopt | IMAGE | Base image. If not connected, bg_r/g/b solid color is used as background. | |
| bg_ropt | INT | 00–255 | Background red (used when no background image). |
| bg_gopt | INT | 00–255 | Background green. |
| bg_bopt | INT | 00–255 | Background blue. |
| bg_alphaopt | FLOAT | 0.000–1 | Alpha of the background in the RGBA output. 0 = transparent background (default). 1 = fully opaque. |
| bg_maskopt | MASK | Clip 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_imageopt | BOOLEAN | false | When 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_invertopt | BOOLEAN | false | Invert 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_1opt | MASK | Mask slot 1. Leave unconnected to skip. | |
| r_1opt | INT | 2550–255 | Red channel for slot 1. |
| g_1opt | INT | 00–255 | Green channel for slot 1. |
| b_1opt | INT | 00–255 | Blue channel for slot 1. |
| expand_1opt | INT | 00–60 | Dilate mask slot 1 by this many pixels before coloring. Grows the painted region outward. |
| feather_1opt | INT | 0-200–200 | Edge 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_2opt | MASK | Mask slot 2. Leave unconnected to skip. | |
| r_2opt | INT | 00–255 | Red channel for slot 2. |
| g_2opt | INT | 2550–255 | Green channel for slot 2. |
| b_2opt | INT | 00–255 | Blue channel for slot 2. |
| expand_2opt | INT | 00–60 | Dilate mask slot 2 by this many pixels before coloring. Grows the painted region outward. |
| feather_2opt | INT | 0-200–200 | Edge 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_3opt | MASK | Mask slot 3. Leave unconnected to skip. | |
| r_3opt | INT | 00–255 | Red channel for slot 3. |
| g_3opt | INT | 00–255 | Green channel for slot 3. |
| b_3opt | INT | 2550–255 | Blue channel for slot 3. |
| expand_3opt | INT | 00–60 | Dilate mask slot 3 by this many pixels before coloring. Grows the painted region outward. |
| feather_3opt | INT | 0-200–200 | Edge 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_4opt | MASK | Mask slot 4. Leave unconnected to skip. | |
| r_4opt | INT | 2550–255 | Red channel for slot 4. |
| g_4opt | INT | 2550–255 | Green channel for slot 4. |
| b_4opt | INT | 00–255 | Blue channel for slot 4. |
| expand_4opt | INT | 00–60 | Dilate mask slot 4 by this many pixels before coloring. Grows the painted region outward. |
| feather_4opt | INT | 0-200–200 | Edge 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)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | RGB composite. |
| rgba | IMAGE | RGBA — filled regions opaque, background transparent (unless bg_alpha > 0). |
| mask | MASK | Union of all active mask slots. |
| status | STRING | — |