diff --git a/zooms_generator.py b/zooms_generator.py index e886218..c9d7241 100644 --- a/zooms_generator.py +++ b/zooms_generator.py @@ -40,8 +40,12 @@ def extract_zooms(src_folder): tree = ET.parse(svg_path) root = tree.getroot() - zooms[idx]["width"] = int(root.get("width")) - zooms[idx]["height"] = int(root.get("height")) + if "." in root.get("width"): + print(f"WARNING: file {svg_path} has a floating width, it will be rounded", file=sys.stderr) + zooms[idx]["width"] = round(float(root.get("width"))) + if "." in root.get("height"): + print(f"WARNING: file {svg_path} has a floating height, it will be rounded", file=sys.stderr) + zooms[idx]["height"] = round(float(root.get("height"))) for area in root.findall('.//{*}rect'): zooms[idx]["zooms"].append([