Inkscape.org
Beyond the Basics simplifying a SVG from command line
  1. #1
    HugoTrentesaux HugoTrentesaux @HugoTrentesaux
    *

    Hello there, I'm new on this forum as well as on inkscape cli. I'm looking for a way to simplify a SVG without using the GUI (I have to repeat the task 294 times, so I do not consider doing it by hand).

    I first tried:

    inkscape -z -f r.svg --select=p --verb=SelectionSimplify
    

    which crashed into:

    Emergency save activated!
    Emergency save completed. Inkscape will close now.
    If you can reproduce this crash, please file a bug at www.inkscape.org
    with a detailed description of the steps leading to the crash, so we can fix it.
    segmentation fault (core dumped)



    (should I file a bug ?)

    and then I tried:

    inkscape -z -f r.svg --verb=SelectionSimplify

    yielding

     

    WARNING: ignoring verb SelectionSimplify - GUI required for this verb.
    

    My svg file is pretty simple, it looks like:

     

    <svg height="1406" width="621">
        <polygon id="p" points="304.5,599.0 305.0,598.5 306.0,598.5 307.0,598.5 308.0,598.5 309.0,598.5 310.0,598.5 311.0,598.5 312.0,598.5 313.0,598.5 314.0,598.5 315.0,598.5 316.0,598.5 316.5,599.0 317.0,599.5 318.0,599.5 319.0,599.5 320.0,599.5 321.0,599.5 322.0,599.5 323.0,599.5 324.0,599.5 325.0,599.5 325.5,600.0 326.0,600.5 327.0,600.5 328.0,600.5 329.0,600.5 330.0,600.5 330.5,601.0 ... 304.5,599.0 " style="fill:lime;stroke:purple;stroke-width:1" />
    </svg>
    

    with more points (that's why I would like to simplify).

    And it's working in the GUI if I select the shape and press Ctrl+L.

    So the question is: Is it possible to perform this in the terminal or not?

    (Inkscape 0.92.3 on Ubuntu)

     

    Rhombencephalon
  2. #2
    Maren Hachmann Maren Hachmann @Moini

    Don't use the -z option. It's needed for this to work currently, as the error message says.

  3. #3
    HugoTrentesaux HugoTrentesaux @HugoTrentesaux

    Ok, so there is no way to use it from command line only. I found a workaround : exporting raster images and using directly potrace.

Inkscape Inkscape.org Inkscape Forum Beyond the Basics simplifying a SVG from command line