π· Smart Facial Masking
The mask is 'smart' only in the sense that OpenCV knows how to feather
- image
- face_landmarks
- face_mask
- masked_image
- exclusion_mask
- coverage_ratio
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_eyespunches two circles where the eyes would be if the face were centered.exclude_mouthcuts an ellipse where the mouth would be if the face were centered.dilationgrows the mask with a morphological ellipse kernel (real).feather_amountblurs the mask edges (real, and genuinely useful for ControlNet/inpainting work).- The
masked_imageoutput 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_eyebrowsis 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_modewon't do what the name says.eyes_onlystill builds the full ellipse minus centered circles.- Stateful settings carry over.
wan_versiontweaks 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.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| mask_mode | COMBO | full_face | 4 options: full_face, eyes_only, mouth_only, custom |
| feather_amount | FLOAT | 5.000β20 | β |
| face_landmarksopt | LANDMARKS_468 | β | |
| exclude_eyesopt | BOOLEAN | false | β |
| exclude_mouthopt | BOOLEAN | false | β |
| exclude_eyebrowsopt | BOOLEAN | false | β |
| dilationopt | INT | 20β10 | β |
| wan_versionopt | COMBO | auto | 3 options: wan_2.1, wan_2.2, auto |
| enable_t2i_adapteropt | BOOLEAN | true | β |
| cache_resultsopt | BOOLEAN | true | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| face_mask | MASK | β |
| masked_image | IMAGE | β |
| exclusion_mask | MASK | β |
| coverage_ratio | FLOAT | β |