From 2fe52efe52902d8b80384168782b6019ce1e8db3 Mon Sep 17 00:00:00 2001 From: heyzec Date: Sat, 23 Jul 2022 16:40:54 +0800 Subject: [PATCH] Fix missing svg attribute bug #76 --- svg2png.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/svg2png.py b/svg2png.py index dab394c..1a94fb2 100755 --- a/svg2png.py +++ b/svg2png.py @@ -50,10 +50,7 @@ def prettify(xml_string): ET.register_namespace(key, value) root = dom.getroot() - width, height = ( - int_ignore_units(root.attrib["width"]), - int_ignore_units(root.attrib["height"]), - ) + _, _, width, height = map(int, filter(bool, re.split(r'[ ,]', root.attrib["viewBox"]))) width_gap, height_gap = (1 - FRAC) * width / 2, (1 - FRAC) * height / 2 # Group all elements that are children of while changing their 'style' attributes