Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you can use an editor like Inkscape to flatten the image (by recursively ungrouping until every path is under the top-level <svg> tag), you should have a bunch of paths that share a coordinate space. There are pathological cases like images that use CSS for positioning, but for most cases this will work.

Then you can use something like svgpathtools (https://github.com/mathandy/svgpathtools) in Python to loop over the paths and get the coordinates.

In case it's useful, I have an example svg to gcode converter here: https://github.com/paulgb/penkit/blob/master/penkit/polargra...

It is for driving a polargraph-style plotter, so it includes a coordinate transform that GP does not need to do.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: