svgpathtools icon indicating copy to clipboard operation
svgpathtools copied to clipboard

Extract bounding box from SVG path

Open FraPochetti opened this issue 4 years ago • 1 comments

Hi, I want to extract the bounding box from the object stored in an SVG path. Can you please confirm that what I am doing is the official way of achieving this?

from svgpathtools import Path
from svgpathtools.paths2svg import big_bounding_box
svg_path = Path('SVG path')
xmin, xmax, ymin, ymax = big_bounding_box([svg_path])  

Thanks!

FraPochetti avatar May 10 '21 11:05 FraPochetti

Have you tried:

svg_path = Path('SVG path')
xmin, xmax, ymin, ymax = svg_path.bbox()

That's what I used when I needed a path's bounding box.

Vrroom avatar Aug 01 '21 09:08 Vrroom