Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting svg to png with inkscape command line failing

Tags:

png

svg

inkscape

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?

like image 333
eddie_cat Avatar asked Jan 11 '16 15:01

eddie_cat


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 .


2 Answers

Just an update for 2021 (it should be typed in oneline - 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"
like image 97
Marcin Orlowski Avatar answered Oct 17 '22 08:10

Marcin Orlowski


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"
like image 28
GolezTrol Avatar answered Oct 17 '22 10:10

GolezTrol