←back to thread

An SVG is all you need

(jon.recoil.org)
281 points sadiq | 1 comments | | HN request time: 0.192s | source
Show context
amelius ◴[] No.46238590[source]
I recently found out that it is surprisingly hard to convert an SVG file that consists of series of line segments into a list of those line segments in Python.

I tried with ChatGPT and Claude but both were not able to find a solution that respects the entire specification, especially transforms.

Initially, my expectation was that there must be a library for this kind of thing, but alas.

replies(5): >>46238679 #>>46238799 #>>46238853 #>>46238966 #>>46239444 #
1. boothby ◴[] No.46238853[source]
I find svg.path to be good for parsing path data

  https://pypi.org/project/svg.path/
For actually parsing the file, there are a number of options (in the end, it's an XML file and I tend to treat it as such)