Nodes/Dream Painter/⬚ Shape Find Bounds
ComfyUI Node

⬚ Shape Find Bounds

Where is my shape, exactly? This node tells you

By alt-key-projectΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
⬚ Shape Find Bounds
  • SHAPE
  • min_x
  • max_x
  • min_y
  • max_y
  • center_x
  • center_y

Shapes in Dream Painter are invisible bundles of coordinates - you can't see a SHAPE, only what it renders into. So when you need to know where a shape actually is - how wide it is, where its center landed after a Copycat trail or a flip - you ask Shape Find Bounds. It's the introspection node for vector geometry, and it answers in plain numbers.

It's the shape-side counterpart to Bitmap Dimensions (which reads pixel sizes off a bitmap). This one reads the normalized coordinate space of a shape: the min and max of each axis plus the center. If you're building anything that positions shapes relative to each other, or checking whether a shape drifted outside the 0–1 box, this is the node that gives you the data to act on.

How it works

The node walks every point in the shape (and every sub-shape inside a combined shape) and computes the axis-aligned bounding box: the smallest rectangle that contains all of it. That gives min_x/max_x (horizontal extent) and min_y/max_y (vertical extent), all in the shape's normalized coordinates. Center is computed the straightforward way - the midpoint of the box on each axis. No transformations, no sampling; it's pure math over the vector data, so it's instant and exact.

A subtlety worth knowing: the bounds are the axis-aligned box. Rotate a shape 45 degrees and its bounds grow, because the box is now fitting a diamond - the reported width/height reflect the bounding box, not the shape's own extent along its axes. If that throws off your math, remember Shape Rotate gives you rotation-about-own-center, and bounds are measured after.

Inputs and outputs

  • SHAPE - the shape to measure.

Outputs (all FLOAT):

  • min_x, max_x, min_y, max_y, center_x, center_y.

Six numbers out of one shape in. Wire them anywhere numbers go - into math nodes, into size calculations, or just to look at them.

Installing

From the Dream Painter pack (comfyui-dream-painter, alt-key-project). ComfyUI Manager β†’ Install Custom Nodes β†’ search Dream Painter β†’ install β†’ restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-painter
cd comfyui-dream-painter
pip install -r requirements.txt

No models, no downloads.

Common issues

The main thing to keep straight: these are normalized coordinates (0–1 space), not pixels. A shape centered in the unit box reports center (0.5, 0.5) whether you render it at 512Γ—512 or 2048Γ—2048 - pixel size is decided at Draw Shape As Bitmap. And an empty shape reports a placeholder (0,0)–(1,1) box, so if you're reading bounds off a Combiner that received no inputs, you'll see the placeholder values, not real geometry. Check that a shape actually has content before trusting its bounds.

CategoryπŸ–Œ DPaint/β–’ shape

Inputs (1)

NameTypeDefaultDescription
SHAPESHAPEβ€”

Outputs (6)

NameTypeDescription
min_xFLOATβ€”
max_xFLOATβ€”
min_yFLOATβ€”
max_yFLOATβ€”
center_xFLOATβ€”
center_yFLOATβ€”