-
-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
Description
Converting the following SVG file (see code bellow) into a PNG caused an exception to be raised:
Traceback (most recent call last):
File "/Volumes/Test/main.py", line 12, in <module>
cairosvg.svg2png(url=URL, write_to=OUTPUT_PATH)
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/__init__.py", line 55, in svg2png
return surface.PNGSurface.convert(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 133, in convert
instance = cls(
^^^^
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 225, in __init__
self.draw(tree)
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 472, in draw
self.draw(child)
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 472, in draw
self.draw(child)
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 480, in draw
paint_mask(self, node, mask, opacity)
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/defs.py", line 145, in paint_mask
mask_surface = SVGSurface(mask_node, None, surface.dpi, surface)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/Test/venv/lib/python3.12/site-packages/cairosvg/surface.py", line 209, in __init__
raise ValueError('The SVG size is undefined')
ValueError: The SVG size is undefined
Here is the code to reproduce:
import cairosvg
URL = "https://upload.wikimedia.org/wikipedia/commons/3/32/Saltwater_Limpet_Diagram-en.svg"
OUTPUT_PATH = "output.png"
cairosvg.svg2png(url=URL, write_to=OUTPUT_PATH)mve