MaskBlackOut(FaceParsing)
Wipe out a strip of a mask from one edge
- mask
- MASK
A blunt, useful little tool: pick an edge (left, top, right, or bottom), pick a position, and everything on the far side of that line gets zeroed out. It's the mask equivalent of taking a ruler to a photo and cropping off a strip - except instead of cropping the image, you're just deleting that strip from the mask's active area, leaving the image itself untouched.
Why you'd want to blank out part of a mask
Semantic segmentation isn't always as clean at the boundaries as you'd like. A face-parsing model asked for "hair" will sometimes bleed a little past where you actually wanted the selection to end - a wisp extending further down than useful, or a "skin" class creeping slightly into territory you'd rather exclude. Rather than accept the model's raw output or go build a whole separate masking step to fix a small edge problem, MaskBlackOut lets you just say "nothing past this line counts," fast.
The other place this earns its keep is compositing safety. If you're about to paste a mask region back into a full image and you know a particular strip near one edge is unreliable - maybe it's right where your face crop met the edge of the bounding box and detail there is untrustworthy - blacking that strip out before the composite is a cheap way to guarantee it doesn't show up in the final result, without having to redo the parsing or hand-paint a fix.
The inputs that matter
mask- the mask you're trimming.direction(defaulttop) - which edge the cut starts from:left,top,right, orbottom. Everything from that edge inward, up toposition, gets zeroed.position(default 10) - how far in from the chosen edge the black-out extends, in pixels.
Output is a single MASK, same size as the input, just with that strip removed. It's a lightweight node you'd typically drop right after the parsing step, or right before a composite, wherever you've spotted a specific edge problem - not something you chain multiple times for general cleanup, since it only handles one straight edge at a time.
Installing it
ComfyUI Manager: search comfyui_face_parsing, install, restart. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/Ryuukeisyou/comfyui_face_parsing.git
Restart ComfyUI. This node does plain mask math and needs no model of its own, but the broader pack downloads its face-parsing model and YOLOv8 face detector to models/face_parsing/ and models/ultralytics/bbox on first run, pulled from HuggingFace (jonathandinu/face-parsing, Bingsu/adetailer) - the README has manual links if that download ever fails for you.
Where this bites
Because it only cuts a straight line parallel to one edge, this node can't follow a curved boundary - it's a ruler, not a brush. If the region you actually want to remove is diagonal or curved (a stray bit of hair that arcs across the frame, say), a single MaskBlackOut will either cut too little or eat into stuff you wanted to keep, and you're better off fixing it with MaskComposite against a purpose-built shape instead. The other easy mistake is direction confusion, same as its cousin MaskBorderDissolveAdvanced: direction refers to the edge of the frame, not the orientation of the face inside it, so on a tilted or rotated head "top" doesn't necessarily mean "top of the head." Preview the mask before and after to confirm you actually cut the strip you meant to, especially before chaining more nodes on top of it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| direction | COMBO | top | 4 options: left, top, right, bottom |
| position | INT | 10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |