Inkscape.org
Beginners' Questions Convert Path to Polygon
  1. #1
    Ion Sinchetru Ion Sinchetru @sinchetru.ion.hhu

    I need to convert paths from SVG file to polygons with points, how can I do that in Inkscape? It is possible to do this using an online converter, but I have more than 250 paths in the file, and changing this in the txt file is ineffective. The problem is that the path forms a view frame around my polygon (see attached image). I am using paths in another program where I put multiple labels on the path and when I center the label it turns out not to be the center of the polygon but the center of the rectangular viewport. This doesn't happen when I use polygons.

    Screenshot 2021 01 18 125937
  2. #2
    Tyler Durden Tyler Durden @TylerDurdenβš–

    Are the files originating in Inkscape? It looks like Inkscape actually uses paths to make pseudo-polygons.

  3. #3
    inklinea inklinea @inklinea⛰️

    250 paths in the file or 250 files with paths in ?Β 

  4. #4
    inklinea inklinea @inklinea⛰️
    πŸ†

    I found a pageΒ https://www.npmjs.com/package/svg-path-to-polygons

    A node package which converts paths to polygons. I does not work on quadratic or elliptical curves, but for simple beziers / lines etc it seems quite good.

    Anyway, I browserified it and uploaded it.Β 

    It should loop through all paths in an svg and convert them to polygons.

    https://www.raincloud.co.uk/svg/paths2polygons/paths2polygons.html

  5. #5
    inklinea inklinea @inklinea⛰️

    Many thanks :)

    I've updated it now, so that it sneakily replaces the paths with polygons keeping the original svg structure , and can still keep all the original attributes (style etc )Β