23

I feel like I must be doing something silly wrong, but I just can't get this to work. This is the command I am running from cmd:

inkscape.com "C:\path\ship.svg" -e --export-png="C:\Path\ship.png" --without-gui

In return, I get:

WARNING: File path "--export-png=C:\path\ship.png" includes directory that doesn't exist.

It does exist. What am I missing?

eddie_cat
  • 2,527
  • 4
  • 25
  • 43

3 Answers3

28

You should have used either -e or --export-png, not both, since they mean the same thing.

But According to the docs, -e and --export-png are no longer available. You should use -o or --export-filename=FILENAME instead. And still, you can use only one of them since -o is just the shortcut for --export-filename.

inkscape "C:\path\ship.svg" -o "C:\path\ship.png"

or

inkscape "C:\path\ship.svg" --export-filename="C:\path\ship.png"
GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • not sure why not work for me. though I am on mac os. – GeneCode Aug 20 '20 at 07:50
  • Hi @GeneCode I never worked on a mac, so I don't know, but there is this page on the InkScape wiki describes some issues and solutions regarding file paths. Maybe that helps? https://wiki.inkscape.org/wiki/index.php/Mac_OS_X – GolezTrol Aug 20 '20 at 09:29
  • 1
    *just* managed to make it work on my Mac. Using latest Inkscape V1.0. I wrote a blog on it too if anybody is interested. https://xcodenoobies.blogspot.com/2020/08/how-to-automation-export-png-in.html – GeneCode Aug 20 '20 at 09:57
  • 2
    On my Mac, it's workd. Maybe you need to specify full path, in my case `/Applications/Inkscape.app/Contents/MacOS/inkscape` You can also add it to the the path, or create a symbolic link to the app `ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape /usr/local/bin/inkscape` – Richnou Apr 02 '22 at 09:27
12

Just an update for 2021 (it should be typed in one line - broken down for readability only):

inkscape --export-width=128
         --export-type=png 
         --export-filename="C:\path\ship.png"
         "C:\path\build.svg"

or if you want transparent PNGs, add --export-background-opacity=0 to invocation arguments:

inkscape --export-background-opacity=0 
         --export-width=128
         --export-type=png 
         --export-filename="C:\path\ship.png"
         "C:\path\build.svg"
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • both code examples look _functionally the same._ The second example redundantly states `--export-background-opacity=0` twice. Did you intend for the examples to somehow show some distinct difference? – marc-medley Jan 30 '22 at 21:14
  • 1
    I think I simply copy/paste and managed to fail to edit the post properly. Fixed, thanks. – Marcin Orlowski Jan 31 '22 at 10:54
1

In inkscape version 1.0.2 following command will work:

inkscape --export-type="png" myfile.svg --export-filename=myfile.png