Skip to content
Berteh edited this page Mar 26, 2014 · 20 revisions

svg-objects-export

Usage examples

Interesting usage examples to integrate in your own workflows: (please contribute!)

  • To export all "group" objects with an id or label that has been modified in inkscape, as long as the id and label don't match: ./svg-objects-export.py --xpath "//svg:g[@inkscape:label!=@id]" input.svg

  • To export all layers of a file in the area of the page first make sure all layers are visible (yes: all at the same time!), save and run: ./svg-objects-export.py --xpath "//svg:g[@inkscape:groupmode='layer']" --extra '--export-area-page --export-id-only' input.svg

exporting from Plain SVG (or SVG from another application)

The examples above rely on the inkscape extensions of SVG (The default inkscape format). They won't work with plain svg files (where, a.o. the concept of layers doesn't exist) or SVG files from other software, where you should rely only on valid SVG elements (see SVG specification), or use a specific id naming scheme.

For instance, if you rename all your layers id into "layer1", "layer2",.. "layer25", then you can export them using the following command:

svg-objects-export --pattern "^layer" --extra " --export-id-only" in.svg

Complementary tools

  • To turn the png into jpgs from command line there is imagemagick: (careful: mogrify command overwrites files without warning) mogrify -format jpg -quality 100 *.png
Clone this wiki locally