Allow svg import without width/height attributes#72
Allow svg import without width/height attributes#72frankbryce wants to merge 1 commit intobtel:masterfrom
Conversation
This is possible in an `.svg` file, as indicated by this stackexchange post [1]. I also have created them and they render just fine. Further, your code seems to already support having a `None` value for `self._height` and `self._width` so it seems that not much has to change.
Without this check, the code raises an exception.
```
...
File "/home/jonnyjack7/.local/lib/python3.9/site-packages/svgutils/compose.py", line 122, in __init__
if svg.width.endswith("%"):
AttributeError: 'NoneType' object has no attribute 'endswith'
```
[1] https://graphicdesign.stackexchange.com/a/71574
|
@hartwork I run into this exact error today. I try to generalize https://github.com/RoepStoep/lidraughts-boardimage to support chess variants playable on pychess.org and it has lots of piece images with no width/height svg attribs. |
|
@gbtami I agree that svg_utils is not getting the love it needs. I see no current use of svg_utils in https://github.com/RoepStoep/lidraughts-boardimage — am I missing something? PS: While I seem to be able to close pull requests here, I have no write access to https://pypi.org/project/svgutils/ , if you're wondering. |
|
@hartwork I find the idea to use svg_utils to load and scale piece images in your https://github.com/hartwork/xiangqi-setup :) Btw I faced another minor issue: Maybe I should create a github fork of this repo and use it until this upstream repo will be active again. Idk. |
|
@gbtami let's take this to e-mail. I sent a reply via e-mail to you just now. |
This is possible in an
.svgfile, as indicated by this stackexchange post [1]. I also have created them and they render just fine. Further, your code seems to already support having aNonevalue forself._heightandself._widthso it seems that not much has to change.Without this check, the code raises an exception.
[1] https://graphicdesign.stackexchange.com/a/71574