Face Segment (RMBG)
Face Segment (RMBG)
- images
- background_color
- IMAGE
- MASK
- MASK_IMAGE
Face Segment masks individual facial features. Want just the eyes? Just the lips? The hair, the skin, the neck? Tick the boxes and it returns a mask of exactly those regions. This is the node for precise face editing - recoloring lips, fixing eyes, masking skin for retouching, isolating hair to change its color - all the things where a whole-face mask is too blunt and hand-painting is too slow.
It works by facial parsing: a model trained to label every pixel of a face into semantic parts. So there's no prompt and no clicking. You just check which features you want and it knows where they are, because it was trained on labeled face data. That's the same family of approach as the Clothes and Body segment nodes in this pack - category toggles instead of text prompts - just pointed at faces.
The inputs are the feature checkboxes: Skin, Nose, Eyeglasses, Left-eye, Right-eye, Left-eyebrow, Right-eyebrow, Left-ear, Right-ear, Mouth, Upper-lip, Lower-lip, Hair, Earring, and Neck. Tick any combination and they merge into one mask - so "both eyes" is two boxes, "the whole mouth" is Mouth plus Upper-lip plus Lower-lip, and "skin only" is just Skin. The real settings under the toggles: process_res (128–2048, default 512) for detail vs. speed, mask_blur and mask_offset to soften and grow/shrink edges, invert_output to flip the selection, and background / background_color for transparent or filled output. Outputs are the standard IMAGE, MASK, and MASK_IMAGE; the MASK is what feeds your inpaint or color adjustment.
Install like the rest of the pack: "Comfyui-RMBG" in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, then pip install -r requirements.txt and restart. The face-parsing model auto-downloads on first run and caches; it's a lightweight model, so this node is cheap to run.
Practical notes from using it. Because facial features are small, process_res matters more here than on most nodes - 512 is fine for a face that fills the frame, but on a small face in a wide shot, bump it up or the lips and eyes come back mushy. The Upper-lip / Lower-lip split lets you mask the mouth interior versus just the lips, which is handy for teeth edits. Add a little mask_blur (1–3) before inpainting so the recolored region blends instead of showing a hard seam - a razor-sharp facial mask almost always looks pasted-on after editing. And the mask_offset control is your friend when a feature mask is biting slightly inside the edge; a +1 or +2 expansion catches the boundary pixels.
Where it fits: this is a surgical tool, not a face detector. If your goal is "improve the whole face," the more common route is a face detailer that detects, crops, and re-renders the entire face automatically. Face Segment is for when you want to touch one part - change eye color, fix a lip line, mask hair for a color swap - and need a clean region mask to hand to an inpaint. For a whole-person or whole-head cutout, use RMBG or BiRefNet instead; pulling a facial parser out to mask an entire head is more precision than the job needs.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| Skinopt | BOOLEAN | false | — |
| Noseopt | BOOLEAN | false | — |
| Eyeglassesopt | BOOLEAN | false | — |
| Left-eyeopt | BOOLEAN | false | — |
| Right-eyeopt | BOOLEAN | false | — |
| Left-eyebrowopt | BOOLEAN | false | — |
| Right-eyebrowopt | BOOLEAN | false | — |
| Left-earopt | BOOLEAN | false | — |
| Right-earopt | BOOLEAN | false | — |
| Mouthopt | BOOLEAN | false | — |
| Upper-lipopt | BOOLEAN | false | — |
| Lower-lipopt | BOOLEAN | false | — |
| Hairopt | BOOLEAN | false | — |
| Earringopt | BOOLEAN | false | — |
| Neckopt | BOOLEAN | false | — |
| process_resopt | INT | 512128–2048 | Processing resolution (higher = more VRAM) |
| mask_bluropt | INT | 00–64 | Blur amount for mask edges |
| mask_offsetopt | INT | 0-64–64 | Expand/Shrink mask boundary |
| invert_outputopt | BOOLEAN | false | Invert both image and mask output |
| backgroundopt | COMBO | Alpha | Choose background type: Alpha (transparent) or Color (custom background color). |
| background_coloropt | COLORCODE | #222222 | Choose background color (Alpha = transparent) |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| MASK_IMAGE | IMAGE | — |