stormvogel.autoscale_svg

Functions

remove_invalid_paths(→ str)

Remove <path> elements that have no d attribute.

autoscale_svg(→ str)

Autoscale an SVG string to the target width while maintaining aspect ratio.

Module Contents

stormvogel.autoscale_svg.remove_invalid_paths(svg_string: str) str

Remove <path> elements that have no d attribute.

Parameters:

svg_string – The raw SVG string to clean.

Returns:

The SVG string with invalid paths removed.

stormvogel.autoscale_svg.autoscale_svg(raw_svg: str, target_width: float) str

Autoscale an SVG string to the target width while maintaining aspect ratio.

Parameters:
  • raw_svg – The raw SVG string to scale.

  • target_width – The desired width for the output SVG.

Returns:

The modified SVG as a string.