rsvg-convert svg to png
SoftwareThere are a few ways to convert an SVG to a PNG without leaving the shell, including *Magick and Inkscape, but I find rsvg-convert the easiest.
Install with Homebrew on macOS, or FreeBSD pkgng. Note the version number on the latter:
# brew install librsvg
# pkg install librsvg2
Then convert as such:
$ rsvg-convert vector.svg
And you’ll be presented with a PNG:
==> ?g?O2??a?{*pD????껌?Xh???4?mF:,?ɶ?0?c3??nb??ܡ?z?
==> ?5??&?4?KZڴ?;w??qt??6>2???hłr??FM???DZ??#_@??{'y
==> ???d??$???xB??birdistheword5??{|?9?ND?x{?????mPJ
==> ?????V?@?'?W\7?M~???h?(RD1???cx@?^E???wy?뢪???ˏ?
==> ;?*??z;KFåIP?L???b??2)??_?HgH?E??9\?̽?Wr?N???J???
==> ?p?4#7O??^e#Ւ?%,{O41?J??}1?$7H???,?I??S?T?/?[ӹ??
==> ??~IA70=????к\??|?<f_??kb?\j|?d?Ә??ʭ??dٌ?
Whoa! I wasn’t expecting that. Let’s redirect somewhere useful:
$ rsvg-convert vector.svg > raster.png
Or even better, use the output flag:
$ rsvg-convert --output raster.png vector.svg
More details are available with --help
, or on the manpage(1).