Merge Bounding Boxes
Union or intersect your detection boxes into one
- bboxes
- BBOX
Bounding boxes come out of detection nodes and LLMs one at a time, but a lot of what you actually want to do is act on the group. Merge Bounding Boxes collapses a list of BBOX values into a single box, two ways: union (the smallest box that contains all of them) or intersect (the region they all share). It's a tiny node, but it's the connective tissue that makes box-based workflows (detect all faces → crop one box around all of them; detect an object in several frames → union them) actually pleasant.
How it works
The math is four min/max operations. For union:
xmin = min(b.xmin for b in bboxes)
xmax = max(b.xmax for b in bboxes)
# same for y
For intersect, the mins and maxes flip - the intersection starts at the largest xmin and ends at the smallest xmax. If the boxes don't overlap at all, the intersection is empty, and the node returns a zero-area box (0, 0, 0, 0) rather than a nonsense negative-area one. That's a detail worth remembering: an empty intersection is a valid result here, and it comes back as a box with no area, which can silently break a downstream crop. Check for it if your boxes are far apart.
Inputs and outputs
bboxes- a list of BBOX values (the socket is list-input, so a batch of boxes from a detection node flows straight in).method-union(default) orintersect.
Output: a single BBOX. The label on the result is set to the method name ("union" or "intersect") so you can tell which one produced it in the UI.
Where you'd use it
- Union: the pack's ParseBBoxQwenVL hands you one box per detected object; union gives you "one box around everything," perfect for a single region-of-interest crop or to feed a detailer.
- Intersect: finding the region common to multiple detections - e.g. the area that's both "person" and "head" - before you crop or mask.
It's also handy for tightening an over-wide box: intersect a loose detection with a tighter one to trim the dead space.
Installing it
It's in Duanyll Nodepack. ComfyUI Manager → search "Duanyll Nodepack" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
No extra dependencies. Find it under duanyll/bbox, next to the box-drawing and box-parsing nodes it plays with. If your downstream expects an Impact-Pack SEGS structure rather than a plain BBOX, the same pack has a converter for that too.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| bboxes | BBOX | — | |
| method | COMBO | union | 2 options: union, intersect |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BBOX | BBOX | — |