One minute
Convert PNG to SVG on Ubuntu
How to convert a PNG to SVG using the Ubuntu CLI.
I am often tweaking images and websites as a way to continue my own professional development and to learn something new. Working on something trivial between big tasks also helps clear my thoughts as I work through other things.
I am far from a Photoshop or Gimp expert and I often need to convert a PNG image, such as a logo or similar, to an SVG. So here is how I do it on the Ubuntu command line using Bash:
- Ensure imagemagick is installed.
- Install
potrace
which is available viaapt
. potrace does not support PNG so I use PNM as an intermediate format. - Use
convert
to convert the source PNG to PNM. Read more about convert. - Use
potrace
to convert the PNM intermediate file to SVG.
$ convert file.png file.pnm
$ potrace file.pnm -s -o file.svg