EN
Inkscape - how to convert svg to png in console?
10
points
Using Inkscapse and Bash it is possible to *.svg
file to *.png
in following way.
1. Inkscape and Bash console on Microsoft Windows example
1.1. With exact size
$ "/C/Program Files/Inkscape/inkscape.exe" -z -e "my_output_file.png" -w 100 -h 40 "my_input_file.svg"
Background RRGGBBAA: ffffff00
Area 0:0:1199.79:3284.24 exported to 100 x 40 pixels (1.16922 dpi)
Bitmap saved as: my_output_file.png
Note:
-w 100 -h 40
means the size of output graphics will be 100x40 px.
1.2. With keeping ratio and scaling to width
Using this approach height will be computed automaticaly to keep oryginal width/height
proportion.
$ "/C/Program Files/Inkscape/inkscape.exe" -z -e "my_output_file.png" -w 100 "my_input_file.svg"
Background RRGGBBAA: ffffff00
Area 0:0:1199.79:3284.24 exported to 100 x 274 pixels (8.0014 dpi)
Bitmap saved as: my_output_file.png
1.3. With keeping ratio and scaling to height
Using this approach width will be computed automaticaly to keep oryginal width/height
proportion.
$ "/C/Program Files/Inkscape/inkscape.exe" -z -e "my_output_file.png" -h 300 "my_input_file.svg"
Background RRGGBBAA: ffffff00
Area 0:0:1199.79:3284.24 exported to 110 x 300 pixels (8.76915 dpi)
Bitmap saved as: my_output_file.png