Nodes/tri3d-comfyui-nodes/Extract facer mask v5.1.0
ComfyUI Node

Extract facer mask v5.1.0

Pick individual face parts out of a facer parsing map (eyes, lips, brows, hair)

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Extract facer mask v5.1.0
  • image
  • MASK
backgroundfalse
hairfalse
lower_lipfalse
inner_mouthfalse
upper_lipfalse
nosefalse
left_eyebrowfalse
right_eyebrowfalse
left_eyefalse
right_eyefalse
facefalse

Face parsing is segmentation for the face: every pixel labeled as skin, eye, eyebrow, nose, lip, hair, or background. This node is the "pick which classes you want" step for the facer parsing palette - feed it a face-parsing map, tick left_eye, nose, hair, whatever, and it returns a MASK of exactly those regions. It's how you build a "protect the eyes" mask for inpainting or a "restyle only the hair" mask.

What it does

One image input and eleven booleans, one per facer class: background, face, hair, left_eye, right_eye, left_eyebrow, right_eyebrow, nose, upper_lip, lower_lip, inner_mouth. For each selected class it matches pixels against that class's exact RGB label in the facer palette (face is [0,138,255], nose [255,192,0], hair [150,0,255], and so on), ORs them together, and returns a single MASK.

The critical detail is in the previous paragraph: the image input is not a normal photo. It's the already-parsed segmentation map - the colored output of a facer-style face-parsing model, where every pixel carries one of those label colors. The node does no parsing of its own; it's pure color-keying on someone else's parsing result. Feed it a regular photograph and every boolean matches nothing, and you get an empty mask. The pack lists facer in its requirements, but this node never calls it - you need to source the parsing map from a facer-capable pipeline yourself.

That also means exact color matching applies, with all its usual strictness: lossy re-encoding or a different parser's palette and the lookups silently fail.

Where it fits

Face-aware inpainting and editing: mask the lips to recolor them without touching the skin, mask the hair for a restyle pass, mask the eyes to keep them out of a facial edit. It's the face-sized counterpart to tri3d-extract-masks-batch, but narrower - this one only understands the facer face palette.

Installing

ComfyUI Manager (search "tri3d"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes

Install requirements (pip install -r custom_nodes/tri3d-comfyui-nodes/requirements.txt). Note the facer package is installed but not used by this node - if you don't already have a face-parsing source, that's the part you'll have to supply.

Troubleshooting

  • Empty mask on a normal photo - expected. The input must be a facer parsing map, not a photograph. Find the node/pipeline that produces the parsing map and feed its output here.
  • Nothing selected - all booleans off means no mask. Tick at least one.
  • Mask includes adjacent regions - the classes are OR'd; if you selected face and nose, you get both. For a strict single region, select only it.

The setup cost (getting a parsing map in the first place) is real, but once you have one, this is a fast, precise way to isolate any facial feature.

CategoryTRI3D

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
backgroundBOOLEANfalse
hairBOOLEANfalse
lower_lipBOOLEANfalse
inner_mouthBOOLEANfalse
upper_lipBOOLEANfalse
noseBOOLEANfalse
left_eyebrowBOOLEANfalse
right_eyebrowBOOLEANfalse
left_eyeBOOLEANfalse
right_eyeBOOLEANfalse
faceBOOLEANfalse

Outputs (1)

NameTypeDescription
MASKMASK