svgpathtools
svgpathtools copied to clipboard
Extract bounding box from SVG path
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!
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.