BBOXes to Unified Mask
Many boxes, one mask — the union node the pack actually recommends
- bboxes
- combined_mask
- individual_masks
- bbox_count
BBOXes to Mask is the node the README stamps RECOMMENDED for anything involving more than one bounding box. Where its single-box sibling BBox to Mask does a clean 1:1 conversion, this one takes a whole list of boxes and produces two things at once: one unified mask that ORs every box together, and a list of individual masks, one per box. Detection workflows that want "a mask of everything detected" need this node specifically.
The most common entry point is a detection JSON blob: run it through the pack's Detection Query, take the bbox_list output, and feed it straight in here. Every detection becomes a rectangle in the combined mask, and each box also gets its own mask for per-object processing. That's the whole "I found five dogs, give me one mask of all of them and a way to touch each one separately" workflow in a single node.
How it works
It declares INPUT_IS_LIST, so it receives the full list at once instead of being iterated item-by-item - that's the crucial difference from the single-box node, and the reason you must use this one for lists. It normalizes both wrapped ([[[x,y,w,h]], ...]) and unwrapped ([[x,y,w,h], ...]) formats, clamps every box to the image bounds, and builds:
combined_mask- every box region set to 1, OR'd together.individual_masks- one mask per box (list output, grid icon).bbox_count- how many boxes were processed.
invert flips the whole thing if you need "everything except the detections."
Inputs and outputs
bboxes(*) - a list of boxes from Detection Query'sbbox_listor JSON to BBox.width(INT, default 512) andheight(INT, default 512) - mask canvas size.invert(BOOLEAN, optional, default off).
Outputs: combined_mask (MASK), individual_masks (list of MASK), bbox_count (INT).
The workflow that made it
Detection JSON
→ Detection Query (class_filter: "DOG_*", min_score: 0.7)
→ bbox_list → BBoxes to Mask (width/height = image dims)
→ combined_mask → inpaint / composite / conditioning
→ individual_masks → per-dog processing
Same pattern works with JSON to BBox if your boxes come as a SAM3-style XYXY string - convert to XYWH first, then in here.
Installing it
It's part of ComfyUI-JK-TextTools. ComfyUI Manager → search "JK-TextTools" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Nakamura2828/ComfyUI-JK-TextTools.git
Restart ComfyUI. No model downloads; the only real requirement is PyTorch, which every ComfyUI install already has.
Gotchas
Same trap as its sibling: the mask is sized by the width/height you set, so set them to your actual image dimensions or the mask won't line up when you composite. And don't confuse the two bbox nodes - BBox to Mask is per-box (and iterates a list for you), BBoxes to Mask is per-list (and won't, because it needs the whole list to build the union). If your combined_mask seems to only ever contain one box, you've probably grabbed the wrong node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| bboxes | * | — | |
| width | INT | 5121–8192 | — |
| height | INT | 5121–8192 | — |
| invertopt | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| combined_mask | MASK | — |
| individual_masks | MASK | — |
| bbox_count | INT | — |