Skip to content

Commit 2fe52ef

Browse files
heyzecmateosss
authored andcommitted
Fix missing svg attribute bug #76
1 parent 1a05515 commit 2fe52ef

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

svg2png.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ def prettify(xml_string):
5050
ET.register_namespace(key, value)
5151

5252
root = dom.getroot()
53-
width, height = (
54-
int_ignore_units(root.attrib["width"]),
55-
int_ignore_units(root.attrib["height"]),
56-
)
53+
_, _, width, height = map(int, filter(bool, re.split(r'[ ,]', root.attrib["viewBox"])))
5754
width_gap, height_gap = (1 - FRAC) * width / 2, (1 - FRAC) * height / 2
5855

5956
# Group all elements that are children of <svg> while changing their 'style' attributes

0 commit comments

Comments
 (0)