Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inkscape command line programming

I'd like to be able to derive new images from a pre-existing image from the command line. To do that, I'd turn on/off specific layers that have portions of the image and then save the resulting image to a file. However, while I can see a number of commands listed in the help to manipulate layers, I don't see any that would allow one to select a specific one and turn it on/off.

like image 402
Brian Avatar asked Mar 11 '12 04:03

Brian


People also ask

How do I open Inkscape command line?

You can launch the interactive command line with inkscape --shell . The main difference to commands in the normal mode is that you need to explicitly indicate when you want to open a file, e.g. file-open:filename. svg; select:flowRootID; query-height .

What is the command to save a file in Inkscape?

(Shift+Ctrl+S): Save your drawing to a file with a new name. The Save As dialog includes a folder for Inkscape templates under the name templates. Saving a drawing with the name default.


1 Answers

If what you want to do can be achieved by deleting a few unwanted elements by their id (say, layer17 and layer4711), you can do it this way:

inkscape image.svg \
  --select=layer17   --verb=EditDelete \
  --select=layer4711 --verb=EditDelete \
  --verb=FileSave --verb=FileClose

Note that this will overwrite image.svg with the result, so if you're scripting this, be sure to work on a copy rather than your originals.

like image 179
ecmanaut Avatar answered Sep 22 '22 14:09

ecmanaut