Exporting drawings from Inkscape using the command line

Inkscape has a command line that lets you do stuff in batch form. The most obvious use of this for an Android developer is to produce the various image resolutions required to support multiple devices on Android. This code opens inkscape, opens the drawing indicated (I created the $desktop variable to facilitate this) and then exports this drawing as a png file.


$ inkscape --file=$desktop/inkscape-work/mystar.svg --export-png=$desktop/myfile.png -D

The -D switch makes sure the whole drawing is exported, not just the page, or selected objects (you can select objects from the command line too).
Width and height can also be provided, or you can give a resolution for the output. This is where the value will be for me. I will get this bit working next time I need multiple resolution drawings.

Some of the command line options can be found here.


Comments

Popular posts from this blog

Building a choropleth map for Irish agricultural data

Early Stopping with Keras

AutoCompleteTextView backed with data from SQLite in Android