π§ Convert BBox to Masks
Turn a face detection box into a mask you can actually use
- face_bboxes
- images
- MASK
Face detectors hand you bounding boxes - four numbers saying "a face is roughly here." Almost nothing else in ComfyUI wants four numbers. Inpainting wants a mask, regional conditioning wants a mask, Detailer-style workflows want a mask. This node is the tiny adapter that bridges the two: it takes a batch of face bboxes plus the images they came from and paints solid white rectangles into a mask batch.
It comes from the π§ SuperNodes pack by SuperCC, and it's about as simple as a node gets - but it sits in the exact spot where "simple" saves you from building the same five-node mask-builder every time you do face work.
How it works
For each frame, the node fills a 1.0 rectangle where the bbox says the face is, in an all-zero mask the size of the image. The interesting part is the four extend_*_percent inputs. They grow each side of the box by a percentage of that box's own size before filling. That's the "headroom" dial: faces are usually detected tight, and if you're going to inpaint or regenerate the region you want a bit of hair and neck context around the box, not a razor-edged crop. extend_up_percent grows from the box height, extend_left_percent from the width, and so on. Negative values shrink the box instead.
The inputs that matter
- face_bboxes (
BBOX) - the detector output. This is the gotcha:BBOXis a type defined by other packs. The README says this node "requires WanAnimatePreprocess," and in practice the Impact Pack is the other big provider ofBBOX(it ships the detector plumbing FaceDetailer leans on). If you don't have one of those installed, the input won't accept a wire. - images (
IMAGE) - used only to size the output masks and clamp boxes to frame bounds. - extend_up/down/left/right_percent - each
-100to500, default0.
Output is a single MASK batch, one per frame. Wire it into a masked inpaint, a conditioning-mask setup, or whatever consumes masks downstream.
Install
Via ComfyUI Manager (search "ComfyUI-SuperNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/sonnybox/ComfyUI-SuperNodes
Then restart ComfyUI. No models to download. One real catch: this pack is written against ComfyUI's newer extension API, so keep ComfyUI reasonably up to date - on an old build none of the SuperNodes will register at all.
Common gotchas
- If your bbox list is shorter than the image batch, the leftover frames come back as empty (all-zero) masks. That's usually a silent failure - a frame with no mask where you expected one.
- The extension is relative to each box's own size. That's sensible (a small face gets proportionally matching headroom) but it means
extend_up_percent: 50on a tiny face is a small number of pixels. - Boxes are clamped to the frame, and the box's own minimum is enforced, so you won't get negative-coordinate masks.
It's a boring node, and that's the compliment. If you're doing face-swap, face-fix, or region work off a detector, it turns the detector's output into something the rest of the graph can actually touch.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| face_bboxes | BBOX | β | |
| images | IMAGE | β | |
| extend_up_percent | INT | 0-100β500 | β |
| extend_down_percent | INT | 0-100β500 | β |
| extend_left_percent | INT | 0-100β500 | β |
| extend_right_percent | INT | 0-100β500 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | β |