Nodes/ComfyUI-BrainDead/BD MP Face Infill
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.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
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)

NameTypeDefaultDescription
imageIMAGEDetection 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).
image1optIMAGEFill 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_pathoptSTRINGPath 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_confidenceoptFLOAT0.500.1–1Face detection confidence (ignored when face_data_path is set).
eyesoptBOOLEANtrue
browsoptBOOLEANtrue
lipsoptBOOLEANtrue
noseoptBOOLEANfalse
oval_subtract_socketsoptBOOLEANtrueface_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_modeoptCOMBOirisiris: 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_insetoptINT20–15Pixels to erode the eyelid hull inward (at 1536px native). 2 = socket sits 2px inside the lid edge at 1536px. 0 = exact eyelid boundary.
expand_xoptINT60–60Master horizontal expansion in pixels at 1536px. Scales proportionally at other resolutions.
expand_yoptINT60–60Master vertical expansion. Reduce to stop zones bleeding into adjacent areas (e.g. brows → eyes).
eyes_expand_xoptINT-1-1–60Eye horizontal override (−1 = master expand_x).
eyes_expand_yoptINT-1-1–60Eye vertical override.
brows_expand_xoptINT-1-1–60Brow horizontal override. Raise to catch side hairs.
brows_expand_yoptINT-1-1–60Brow vertical override. Keep low to avoid eye socket bleed.
brow_bandoptINT122–60Base 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_bandoptINT60–40Minimum 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_xoptINT-1-1–60Lip horizontal override. Raise to cover laugh lines.
lips_expand_yoptINT-1-1–60Lip vertical override.
nose_expand_xoptINT-1-1–60
nose_expand_yoptINT-1-1–60
featheroptINT3-30–30Master 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_featheroptINT-1-1–30Eye feather override. −1 = use master feather (inherits positive/negative direction). 0+ = outward override.
brows_featheroptINT-1-1–30Brow feather override. −1 = use master feather.
lips_featheroptINT-1-1–30Lip feather override. −1 = use master feather.
nose_featheroptINT-1-1–30Nose feather override. −1 = use master feather.
fill_modeoptCOMBOflatflat: fill_r/g/b. surround: fill the socket with surrounding skin colour (NS inpaint). inpaint: per-zone Telea.
fill_from_guideoptBOOLEANfalsesurround / 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_roptINT2550–255
fill_goptINT2550–255
fill_boptINT2550–255
lip_modeoptCOMBOorganicControls 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)

NameTypeDescription
socket_imageIMAGERGB — socket regions replaced by fill.
alpha_imageIMAGERGBA — socket regions fully transparent.
socket_maskMASKFeathered union of all active zone masks.
left_eyeMASK
right_eyeMASK
eyesMASK
left_browMASK
right_browMASK
browsMASK
lipsMASK
noseMASK
face_ovalMASKMediaPipe 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_planeMASKRotated 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.
statusSTRING