Nodes/comfyui-panels/Polygon.bounds (unwrapped)
ComfyUI Node

Polygon.bounds (unwrapped)

A polygon's bounds as four plain integers, for the other packs

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Polygon.bounds (unwrapped)
  • polygon
  • min_x
  • min_y
  • max_x
  • max_y

Polygon.bounds (unwrapped) is the interop node in this pack. Its sibling Polygon.bounds gives you the bounding box as a single BBOX value - the pack's own currency. This one unwraps it into four plain INT outputs - min_x, min_y, max_x, max_y - rounded to whole pixels, precisely so you can hand them to node packages that don't know what a BBOX is. The author's description says it outright: "For potential use with other node packages."

The use case is honest and specific: you've built your page as shapely polygons, but the rest of your ComfyUI graph speaks in plain integers. Crop nodes, sampler conditioning, workflow-parameter nodes, LoRA schedulers that want a region, display widgets - plenty of them just want numbers. This node is the bridge: feed it a polygon, and the four bounds values come out rounded, ready to plug into anything.

Input is a single polygon. Outputs are min_x, min_y, max_x, max_y - the axis-aligned bounds of the polygon, rounded. Rounding to ints is deliberate; it makes the values usable as pixel coordinates, which is what integer consumers expect.

The realistic workflow: get a panel's bounds this way, feed min_x/min_y into some other pack's crop or region node, and keep the BBOX version around for this pack's own nodes when you need sub-pixel fidelity. There's a small philosophical note worth carrying: because the values are rounded, they're approximations of the true bounds - fine for pixel work, wrong if you round-trip them back into geometry and expect exact math. If precision matters, use the BBOX version and do the arithmetic inside the pack's coordinate space.

It's a thin utility node, and that's okay. You'll reach for it exactly once per workflow - when you need to get a polygon's numbers out of the geometry world and into some other node that doesn't speak shapely. That's its whole job, and it does it without surprises.

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.

CategoryBmad/Panels

Inputs (1)

NameTypeDefaultDescription
polygonPOLYGON

Outputs (4)

NameTypeDescription
min_xINT
min_yINT
max_xINT
max_yINT