diff --git a/CHANGELOG.md b/CHANGELOG.md index 70898614..629c31d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Release date: UNRELEASED ### Bug fixes -* ... +* Fixed a crash when reading SVG with simplify active (via the `read --simplify` command or the read APIs with `simplify=True`) (thanks to @nataquinones) (#732) ## 1.14 diff --git a/tests/test_commands.py b/tests/test_commands.py index 4fa7fe13..25cc2f9e 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -43,6 +43,7 @@ class Command: Command("circle 0 0 1"), Command("ellipse 0 0 2 4"), Command(f"read '{EXAMPLE_SVG}'", preserves_metadata=False), + Command(f"read -s '{EXAMPLE_SVG}'", preserves_metadata=False), Command(f"read -m '{EXAMPLE_SVG}'", preserves_metadata=False), Command(f"read -a stroke '{EXAMPLE_SVG}'", preserves_metadata=False), Command("write -f svg -"), diff --git a/vpype/io.py b/vpype/io.py index 7bf0e97e..d1e3ded1 100644 --- a/vpype/io.py +++ b/vpype/io.py @@ -336,7 +336,8 @@ def _process_path(path): line = seg.npoint(np.linspace(0, 1, step)) if simplify: - line = np.array(LineString(line).simplify(tolerance=quantization)) + line = LineString(line).simplify(tolerance=quantization) + line = np.array(line.coords, dtype=float) line = line.view(dtype=complex).reshape(len(line))