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:

  1. Ensure imagemagick is installed.
  2. Install potrace which is available via apt. potrace does not support PNG so I use PNM as an intermediate format.
  3. Use convert to convert the source PNG to PNM. Read more about convert.
  4. Use potrace to convert the PNM intermediate file to SVG.
$ convert file.png file.pnm  
$ potrace file.pnm -s -o file.svg