ComfyUI Node

😷 Smart Facial Masking

The mask is 'smart' only in the sense that OpenCV knows how to feather

By kanibusΒ·Created about a year agoΒ·Updated about a year agoΒ· 5
😷 Smart Facial Masking
  • image
  • face_landmarks
  • face_mask
  • masked_image
  • exclusion_mask
  • coverage_ratio
β—„mask_modefull_faceβ–Ί
β—„feather_amount5.00β–Ί
β—„exclude_eyesfalseβ–Ί
β—„exclude_mouthfalseβ–Ί
β—„exclude_eyebrowsfalseβ–Ί
β—„dilation2β–Ί
β—„wan_versionautoβ–Ί
β—„enable_t2i_adaptertrueβ–Ί
β—„cache_resultstrueβ–Ί

SmartFacialMasking sits in an awkward middle ground even for this pack: the mask math is real OpenCV, but the "smart" part isn't. It produces a feathered, dilated elliptical face mask - and that ellipse is always drawn in the center of the frame, regardless of where the face in your image actually is. There's a mask_mode selector and even a face_landmarks input, and the shipped code reads neither.

Like most of the kanibus/kanibus pack (a Claude-generated repo, last commit Aug 2025), this node has the shape of a useful tool without the substance. Let's be precise about what works and what doesn't.

What it actually does

Read nodes/smart_facial_masking.py: it takes your image, assumes a face is dead-center, and draws an ellipse as the base face mask - size varies by wan_version (480p gets a smaller ellipse, 720p a bigger one). Then:

  • exclude_eyes punches two circles where the eyes would be if the face were centered.
  • exclude_mouth cuts an ellipse where the mouth would be if the face were centered.
  • dilation grows the mask with a morphological ellipse kernel (real).
  • feather_amount blurs the mask edges (real, and genuinely useful for ControlNet/inpainting work).
  • The masked_image output applies the mask to the image (real).

So the mask processing is genuine - feathering and dilation work exactly like they do in any decent masking node. What's missing is any face detection. mask_mode (full_face/eyes_only/mouth_only/custom) is accepted and never branched on; the face_landmarks LANDMARKS_468 input is accepted and never read. If your subject isn't centered and roughly portrait-sized, the mask will be in the wrong place.

Outputs: face_mask (MASK), masked_image (IMAGE), exclusion_mask (MASK - the eyes/mouth cutouts), coverage_ratio (FLOAT - fraction of pixels covered, which is real and useful).

The inputs that matter

  • feather_amount (0–20, default 5) - this is the one worth tuning. Soft edges make masked regions play nice with inpainting and ControlNet.
  • dilation (0–10, default 2) - grow the mask to cover edges.
  • exclude_eyes / exclude_mouth / exclude_eyebrows - the first two work (positionally, centered); exclude_eyebrows is accepted but does nothing in the code.
  • mask_mode - cosmetic; all modes produce the same centered-ellipse behavior.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/kanibus/kanibus
cd kanibus    # lowercase - README's "cd Kanibus" fails on case-sensitive systems
pip install -r requirements.txt   # or requirements_minimal.txt if it clashes
python install.py

Restart ComfyUI, find it under Kanibus. No model downloads. The README's "5.6GB of required ControlNet models" line doesn't apply to this node.

The honest recommendation

If your subject happens to be centered, this gives you a fine soft-edged mask fast - and you can combine it with the pack's genuinely real LandmarkPro468, whose convex-hull face_mask is actually face-aware. For real "smart" facial masking in ComfyUI, the mature approach is a face-detector + mask-from-landmarks pipeline (or BiRefNet/segment-based nodes); that's where the ecosystem actually delivers. Use this node for the feathering math, not the intelligence.

Gotchas

  • Off-center face = misplaced mask. Every time. Check the annotated preview before relying on it.
  • mask_mode won't do what the name says. eyes_only still builds the full ellipse minus centered circles.
  • Stateful settings carry over. wan_version tweaks mutate the ellipse size between runs; restart ComfyUI if outputs look stale.

It's the friendlier end of this pack's placeholder spectrum - the plumbing is real, the AI is assumed. If you know the mask is just a centered ellipse, you can still use it for fast face-region masks and move on.

CategoryKanibus

Inputs (11)

NameTypeDefaultDescription
imageIMAGEβ€”
mask_modeCOMBOfull_face4 options: full_face, eyes_only, mouth_only, custom
feather_amountFLOAT5.000–20β€”
face_landmarksoptLANDMARKS_468β€”
exclude_eyesoptBOOLEANfalseβ€”
exclude_mouthoptBOOLEANfalseβ€”
exclude_eyebrowsoptBOOLEANfalseβ€”
dilationoptINT20–10β€”
wan_versionoptCOMBOauto3 options: wan_2.1, wan_2.2, auto
enable_t2i_adapteroptBOOLEANtrueβ€”
cache_resultsoptBOOLEANtrueβ€”

Outputs (4)

NameTypeDescription
face_maskMASKβ€”
masked_imageIMAGEβ€”
exclusion_maskMASKβ€”
coverage_ratioFLOATβ€”