Skip to content
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

ValueError: could not convert string to float: 'null' #422

Open
bpfrd opened this issue Apr 23, 2024 · 1 comment
Open

ValueError: could not convert string to float: 'null' #422

bpfrd opened this issue Apr 23, 2024 · 1 comment
Labels

Comments

@bpfrd
Copy link

bpfrd commented Apr 23, 2024

Hello,

I get the below error when I try to convert my svg data to png

File [~\pythonEnv\lib\site-packages\cairosvg\surface.py:410](http://localhost:8888/lab/tree/GraphDL/~/pythonEnv/lib/site-packages/cairosvg/surface.py#line=409), in Surface.draw(self, node)
    407         pass
    409 # Get stroke and fill opacity
--> 410 stroke_opacity = float(node.get('stroke-opacity', 1))
    411 fill_opacity = float(node.get('fill-opacity', 1))
    412 if opacity < 1 and not node.children:

ValueError: could not convert string to float: 'null'

I was wondering how I can fix it?

best

@liZe liZe added the feature label Apr 23, 2024
@liZe
Copy link
Member

liZe commented Apr 23, 2024

That’s probably because CairoSVG doesn’t handle percentages for opacity. The solution is to allow them everywhere we parse *-opacity properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants