Most answers given here ignore the at the desired size part of the question. I could not get satisfying results using convert
when "upscaling" an SVG. inkscape
does a better job and also preserves background transparency.
Depending on your use case, use one of the following options:
- export at specified DPI:
inscape in.svg -d 300 -e out.png
- export at specified width (maintaining aspect ratio):
inscape in.svg -w 800 -e output.png
- export at specified height (maintaining aspect ratio):
inscape in.svg -h 600 -e output.png
Note that specifying both width and height does not preserve the aspect ratio.
To convert many files at once, adjust the following to your use case (in bash
or compatible):
for f in *.svg; do
inkscape $f -d 300 -e ${f%.*}.png
done
You can also get it via the Windows Subsystem for Linux (WSL), with
apt install imagemagick
– antonyh – 2017-05-09T12:12:02.213(this applies to linux, may apply to windows) if you turn -verbose on IM then it would appear that IM itself uses inkscape to create an intermediate eps file. therefore i would suggest @zetah's answer – northern-bradley – 2017-08-09T18:07:00.303
Here's a small ImageMagick based converter for Windows: https://www.fosshub.com/SVG2PNG.html It's old (from 2014), but still works and you don't have to read any docs.
– Reptile – 2018-06-04T10:50:43.320