You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SVG Library crashes with error "Parameter is not valid".
The cause is that the SVG contains an element of width 100% and height 100%, but the main document doesn't have width and height specified explicitly. This causes internally the width and height to be set to 0 and subsequently an attempt to set scaling to 0, 0 (which the Graphics class doesn't like too much).
However, the document does have viewbox defined and Inkscape seems to treat it as width and height when these attributes are missing. My suggestion is to use parameters from the viewbox as missing width and height.
After enforcing Inkscape to add missing attributes to the SVG, it is being rendered correctly by the library.
I have the same crash with famous Tiger SVG image (there is "Height" defined, but no "Width"). It crashes with the latest SVG library versions 3.4.5 and 3.4.6. But version 3.4.4 works fine.
Description
SVG Library crashes with error "Parameter is not valid".
The cause is that the SVG contains an element of width 100% and height 100%, but the main document doesn't have width and height specified explicitly. This causes internally the width and height to be set to 0 and subsequently an attempt to set scaling to 0, 0 (which the Graphics class doesn't like too much).
However, the document does have viewbox defined and Inkscape seems to treat it as width and height when these attributes are missing. My suggestion is to use parameters from the viewbox as missing width and height.
After enforcing Inkscape to add missing attributes to the SVG, it is being rendered correctly by the library.
Example data
https://freesvg.org/check-mark
Attached as well.
Used Versions
Version 3.4.4 from nuget. Confirmed with master branch (as from 23.10.2023)
The text was updated successfully, but these errors were encountered: