EN
Inkscape - how to convert svg to png in console?
13 points
Using Inkscape and Bash it is possible to *.svg
file to *.png
in the following way.
Quick solution:
xxxxxxxxxx
1
"/C/Program Files/Inkscape/bin/inkscape.exe" --export-type="png" --export-filename="output_file.png" -w 100 -h 40 "input_file.svg"
When we have installed Inkscape under Windows we are able to use the command line to make some SVG files conversion,
xxxxxxxxxx
1
"/C/Program Files/Inkscape/bin/inkscape.exe" --export-type="png" --export-filename="output_file.png" -w 100 -h 40 "input_file.svg"
or:
xxxxxxxxxx
1
# Older Inkscape:
2
"/C/Program Files/Inkscape/inkscape.exe" -z -e "output_file.png" -w 100 -h 40 "input_file.svg"
Note:
-w 100 -h 40
means the size of output graphics will be 100x40 px.
Example output:
xxxxxxxxxx
1
Background RRGGBBAA: ffffff00
2
Area 0:0:1199.79:3284.24 exported to 100 x 40 pixels (1.16922 dpi)
3
Bitmap saved as: output_file.png
Using this approach height will be computed automatically to keep the original width/height
proportion.
xxxxxxxxxx
1
$ "/C/Program Files/Inkscape/bin/inkscape.exe" --export-type="png" --export-filename="output_file.png" -w 100 "input_file.svg"
or:
xxxxxxxxxx
1
# Older Inkscape:
2
"/C/Program Files/Inkscape/inkscape.exe" -z -e "output_file.png" -w 100 "input_file.svg"
Example output:
xxxxxxxxxx
1
Background RRGGBBAA: ffffff00
2
Area 0:0:1199.79:3284.24 exported to 100 x 274 pixels (8.0014 dpi)
3
Bitmap saved as: output_file.png
Using this approach width will be computed automatically to keep the original width/height
proportion.
xxxxxxxxxx
1
$ "/C/Program Files/Inkscape/bin/inkscape.exe" --export-type="png" --export-filename="output_file.png" -h 300 "input_file.svg"
or:
xxxxxxxxxx
1
# Older Inkscape:
2
"/C/Program Files/Inkscape/inkscape.exe" -z -e "output_file.png" -h 300 "input_file.svg"
Example output:
xxxxxxxxxx
1
Background RRGGBBAA: ffffff00
2
Area 0:0:1199.79:3284.24 exported to 110 x 300 pixels (8.76915 dpi)
3
Bitmap saved as: output_file.png