ComfyUI Node
BD MP Face Infill
Fills face feature sockets for 2D animation flipbook textures. expand_x / expand_y use an elliptical dilation kernel so you can expand lips wide (laugh lines) without growing brows into eye sockets. Per-zone overrides (eyes_expand_x, brows_expand_y, …) take priority when set ≥ 0; −1 falls back to the master expand_x / expand_y. inpaint processes each zone independently (brows before eyes) so they can't contaminate each other's fill.
BD MP Face Infill
- image
- image1
- socket_image
- alpha_image
- socket_mask
- left_eye
- right_eye
- eyes
- left_brow
- right_brow
- brows
- lips
- nose
- face_oval
- lip_plane
- status
◄face_data_path►
◄detection_confidence0.50►
◄eyestrue►
◄browstrue►
◄lipstrue►
◄nosefalse►
◄oval_subtract_socketstrue►
◄eye_modeiris►
◄eye_inset2►
◄expand_x6►
◄expand_y6►
◄eyes_expand_x-1►
◄eyes_expand_y-1►
◄brows_expand_x-1►
◄brows_expand_y-1►
◄brow_band12►
◄lip_band6►
◄lips_expand_x-1►
◄lips_expand_y-1►
◄nose_expand_x-1►
◄nose_expand_y-1►
◄feather3►
◄eyes_feather-1►
◄brows_feather-1►
◄lips_feather-1►
◄nose_feather-1►
◄fill_modeflat►
◄fill_from_guidefalse►
◄fill_r255►
◄fill_g255►
◄fill_b255►
◄lip_modeorganic►
Category🧠BrainDead/Segmentation
Inputs (34)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Detection guide — MediaPipe runs on this to locate feature zones. Use your cleanest, most representative image (e.g. neutral pose, good lighting). Does NOT need to be the image you want to fill. If face_data_path is wired, MediaPipe is skipped entirely and this image is used ONLY as the fill target (same as image1 behaviour). | |
| image1opt | IMAGE | Fill target (optional). The image that actually gets infilled. Masks are computed from 'image' but applied to 'image1'. Leave unconnected to fill 'image' itself (original behaviour). Typical use: image = ILM / line-art guide, image1 = albedo / skin layer. Resolution should match 'image'; if different it is resized to match. | |
| face_data_pathopt | STRING | Path to a .mpface.npz file saved by BD MP Save Face Data. When wired (connect npz_path output), MediaPipe is bypassed — the saved eye/brow/lip/nose/oval masks are used directly. Enables infilling on modified images where MediaPipe would fail (closed mouth, removed eyes, delighted, albedo-prepped, etc.). NOTE: masks in the NPZ already include the expand from BD MP Face Mask. Set expand_x=0, expand_y=0 here to avoid double-expansion, or leave as-is to add extra dilation on top. | |
| detection_confidenceopt | FLOAT | 0.500.1–1 | Face detection confidence (ignored when face_data_path is set). |
| eyesopt | BOOLEAN | true | — |
| browsopt | BOOLEAN | true | — |
| lipsopt | BOOLEAN | true | — |
| noseopt | BOOLEAN | false | — |
| oval_subtract_socketsopt | BOOLEAN | true | face_oval output only. When ON (default): socket zones (eyes, brows, lips, nose — whichever are active) are subtracted from the face_oval mask so the oval doesn't overlap the socket areas. Use for blending layers where the oval should be the skin/non-socket region. OFF: raw face oval with no subtraction. |
| eye_modeopt | COMBO | iris | iris: eyelid hull eroded inward by eye_inset — socket sits just inside the lid edge, feather provides outside sample zone. eyelid: raw eyelid hull (may clip lashes). |
| eye_insetopt | INT | 20–15 | Pixels to erode the eyelid hull inward (at 1536px native). 2 = socket sits 2px inside the lid edge at 1536px. 0 = exact eyelid boundary. |
| expand_xopt | INT | 60–60 | Master horizontal expansion in pixels at 1536px. Scales proportionally at other resolutions. |
| expand_yopt | INT | 60–60 | Master vertical expansion. Reduce to stop zones bleeding into adjacent areas (e.g. brows → eyes). |
| eyes_expand_xopt | INT | -1-1–60 | Eye horizontal override (−1 = master expand_x). |
| eyes_expand_yopt | INT | -1-1–60 | Eye vertical override. |
| brows_expand_xopt | INT | -1-1–60 | Brow horizontal override. Raise to catch side hairs. |
| brows_expand_yopt | INT | -1-1–60 | Brow vertical override. Keep low to avoid eye socket bleed. |
| brow_bandopt | INT | 122–60 | Base half-height of the brow arch band in 1536px-normalised pixels. Sets minimum band thickness independently of expand_y. Increase if brows look too thin. |
| lip_bandopt | INT | 60–40 | Minimum half-height of the lip band from centroid (1536px-normalised). Ensures full coverage even when the mouth is nearly closed. expand_y adds on top of this. |
| lips_expand_xopt | INT | -1-1–60 | Lip horizontal override. Raise to cover laugh lines. |
| lips_expand_yopt | INT | -1-1–60 | Lip vertical override. |
| nose_expand_xopt | INT | -1-1–60 | — |
| nose_expand_yopt | INT | -1-1–60 | — |
| featheropt | INT | 3-30–30 | Master feather radius for socket edges. Positive: ramp starts AT the edge and expands OUTWARD — interior stays fully opaque (1.0), only the boundary bleeds out. Negative: ramp goes INWARD from the edge — fill fades toward its own boundary, exterior stays 0. 0 = hard binary edge. |
| eyes_featheropt | INT | -1-1–30 | Eye feather override. −1 = use master feather (inherits positive/negative direction). 0+ = outward override. |
| brows_featheropt | INT | -1-1–30 | Brow feather override. −1 = use master feather. |
| lips_featheropt | INT | -1-1–30 | Lip feather override. −1 = use master feather. |
| nose_featheropt | INT | -1-1–30 | Nose feather override. −1 = use master feather. |
| fill_modeopt | COMBO | flat | flat: fill_r/g/b. surround: fill the socket with surrounding skin colour (NS inpaint). inpaint: per-zone Telea. |
| fill_from_guideopt | BOOLEAN | false | surround / inpaint only. When ON and image1 is connected: sample fill COLORS from the detection guide (image) rather than the fill target (image1). The result is still applied to image1. Use when image1 already has pre-filled socket areas — those pre-fills would otherwise bias the surrounding-color sample and bleed into the fill. Sampling from the clean guide avoids that contamination. Has no effect when image1 is not connected, or with fill_mode=flat. |
| fill_ropt | INT | 2550–255 | — |
| fill_gopt | INT | 2550–255 | — |
| fill_bopt | INT | 2550–255 | — |
| lip_modeopt | COMBO | organic | Controls the shape used for lip socket fill: organic (default): MediaPipe outer lip contour with lip_band minimum height and expand applied — can appear wider/taller than the actual lip pixels. contour: exact outer lip polygon with zero expansion and no forced minimum height. Tight crop that follows the MediaPipe landmark boundary precisely. plane: Rotated rectangle aligned to the 61→291 mouth axis — a flat geometric polygon for stylised pre-draw before Qwen. The lip_plane output always emits the rotated rectangle regardless of this setting. |
Outputs (14)
| Name | Type | Description |
|---|---|---|
| socket_image | IMAGE | RGB — socket regions replaced by fill. |
| alpha_image | IMAGE | RGBA — socket regions fully transparent. |
| socket_mask | MASK | Feathered union of all active zone masks. |
| left_eye | MASK | — |
| right_eye | MASK | — |
| eyes | MASK | — |
| left_brow | MASK | — |
| right_brow | MASK | — |
| brows | MASK | — |
| lips | MASK | — |
| nose | MASK | — |
| face_oval | MASK | MediaPipe face oval mask. By default, active socket zones are subtracted (oval_subtract_sockets=ON) so this gives the skin/non-socket face region for blending. |
| lip_plane | MASK | Rotated rectangle aligned to the 61→291 mouth axis. Always a flat geometric polygon regardless of lip_mode. Use to pre-draw a stylised midgrey plane before Qwen. |
| status | STRING | — |