Polygon.bounds
The polygon's bounding box, handed to other nodes as a BBOX
- polygon
- BBOX
Polygon.bounds is the plumbing node that keeps a comic workflow honest. Every panel in comfyui-panels is a shapely polygon with an axis-aligned bounding box, and this node is how you get that box out of the geometry world and into the image world. It literally calls polygon.bounds - one line, no mystery - and hands you a BBOX you can wire into every crop, paste, and mask operation in the pack.
Why a node that just reads a bounding box is worth having: ComfyUI is a graph, and polygons carry coordinates that plain crop/paste nodes can't consume. The BBOX type is the pack's shared currency - CropImageByBBox, CropMaskByBBox, PasteCrops, PolygonToMask, and RelativeCropImage all take one. This node is the adapter that produces it from a polygon, so you can compute a panel's footprint and feed it straight into image operations without hand-typing numbers.
It takes one input - polygon - and emits one BBOX (min_x, min_y, max_x, max_y) in the polygon's coordinate space, which is the same space your canvas was built in. In practice that means: build panels → this node gives you each panel's box → crop the page at that box → generate/inpaint inside it → paste back at the same box. Coordinates line up because they all trace back to the same canvas polygon.
If you need the four numbers as individual values instead of a packaged BBOX - say, to feed a node from another pack that just wants plain integers - the Polygon.bounds (unwrapped) variant is the one, since it unpacks to four INT outputs. And if you want to go the other direction and build a BBOX from raw ints, there's BBoxFromInts in the same pack.
The one thing to keep in mind is the coordinate orientation: shapely's y-axis points up, images' y-axis points down. The pack handles the flip internally when rasterizing, so the min/max values are what you'd expect - but don't go "correcting" the numbers yourself. Trust the node, pass the BBOX around whole, and let the image-side nodes handle the axis.
Installing
Part of comfyui-panels by bmad4ever. Via ComfyUI Manager (search "comfyui-panels") and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels
Deps: shapely, matplotlib, opencv-python - no models, no GPU. Shapely is pinned exactly, so version clashes with other packs are the realistic import failure.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| polygon | POLYGON | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BBOX | BBOX | — |