Search code examples
inkscape

Inkscape - Set Extension Parameters from Command Line


TL;DR: Is it possible to set parameters defined in INX files from the command line?


I want to batch-export SVG files to Silverlight-compatible XAML using Inkscape. Via the UI this is no problem via File > Save As... > Microsoft XAML (*.xaml) > Check Silverlight compatible. However, when using the command line, I can't seem to find a way to set this Silverlight compatible mode.

This is the command I'm using right now:

inkscape --export-filename="output.xaml" --export-type=xaml --export-extension="org.inkscape.output.xaml" "input.svg"

I tried using the option --silverlight, --silverlight=true and also --include-silverlight=true but they all return a Unknown option error.

The parameter is defined in <Inkscape Dir>/share/inkscape/extensions/svg2xaml.inx:

<param name="silverlight" type="bool" gui-text="Silverlight compatible XAML">false</param>

Is it possible to set these parameters from the command line?


Solution

  • Yes. For most extensions, there are two options:

    1. Just call the extension directly, without the detour via Inkscape. Then you can provide the parameters as command line arguments to the .py file. This option is not available for the xaml export extension, though, as that does not use a Python script directly.
    2. Use a preferences file where the setting you want is saved for your command line calls of Inkscape. This is what you'd need to do here.