Nodes/comfyui_face_parsing/MaskToBBoxList(FaceParsing)
ComfyUI Node

MaskToBBoxList(FaceParsing)

Turn any mask into bounding boxes this pack understands

By Ryuukeisyou·Created 3 years ago·Updated about a year ago· 193
MaskToBBoxList(FaceParsing)
  • mask
  • BBOX_LIST
pad0

Not every workflow starts with a YOLO detector. Sometimes you already have a mask from somewhere else - a segmentation model, a manually painted mask, an output from a completely different custom node pack - and you want to feed it into this pack's bbox-based tools (cropping, insertion, resizing) instead of running face detection from scratch. MaskToBBoxList is the bridge: it finds the bounding box of each separate region in a mask and returns them as a proper BBOX_LIST, the same type FaceBBoxDetect produces.

The inputs that matter

  • mask (MASK) - required, the mask you're converting. If the mask has multiple disconnected white regions, each one becomes its own box in the output list - functionally similar to how a multi-face detection returns one box per face.
  • pad (INT, default 0, min 0) - extra pixels added around each computed box, same idea as dilation on the detection nodes. Useful because a bounding box drawn exactly at a mask's edges can be too tight once you actually crop and process that region - a little breathing room avoids clipping the feature the mask was drawn around.

The output is a single BBOX_LIST, ready to feed into ImageCropWithBBoxList, BBoxListItemSelect, or anywhere else in the pack that consumes a box list.

Where it fits

This is most useful when you're combining this pack with something outside its own detection pipeline - say, a mask that came from a different segmentation model, or one you painted by hand for a specific region you want to isolate and process the same way this pack handles detected faces. It's also handy internally: if you've already got a MASK out of FaceParsingResultsParser and want to work with the bounding region of that mask rather than its exact pixel shape (for a crop, say), this converts one into the other.

Installing it

Bundled with the whole pack:

  • ComfyUI Manager - search "comfyui_face_parsing", install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Ryuukeisyou/comfyui_face_parsing.git, restart ComfyUI.

No dependencies beyond the pack itself.

Common issues

If your mask has noise - small stray white pixels scattered outside the region you actually care about, which is common with masks generated by other models rather than painted by hand - you can end up with extra tiny boxes in the output that don't correspond to anything meaningful. Clean up or threshold the mask before this node if you're seeing more boxes than expected. And if a box comes out tighter than you want once you crop with it, that's what pad is for - raise it a bit rather than fighting the mask itself.

Categoryface_parsing

Inputs (2)

NameTypeDefaultDescription
maskMASK
padINT0

Outputs (1)

NameTypeDescription
BBOX_LISTBBOX_LIST