-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imageSize()
with svg images
#517
Comments
Does image() support SVG to begin with? |
I was able to draw some svgs on a canvas, so I assumed drawbot supports them |
Ah, it doesn't work on 10.15 for example. It's mostly an OS support thing. That said the |
A lots goes wrong while drawing svg as images... but we could get the size from the nsimage object, we just have to flag |
my workaround for now is this: import xml.etree.ElementTree as ET
tree = ET.parse(imagePath)
_, _, imageWidth, imageHeight = [float(i) for i in tree.getroot().attrib["viewBox"].split()] |
I understand that svg support as input format might be complicated and unreliable. I ended up converting the svg files in pdf with cairosvg and it worked fine. I'll open a pull request to add to the docs which formats are supported by the image proporties functions and the ImageObject. |
I can't get the correct width and height from a svg file with
imageSize()
. Even though the svg has aviewBox
attribute with positive width and height,imageSize()
returns(0, 0)
The text was updated successfully, but these errors were encountered: