Convert PNG to SVG

In some cases, I needed to process a raster-to-vector conversion. There are at least 2 ways to do that: the hard way and the lazy way.

In short, the hard way is to open original image in vector drawing software and redraw all the paths by hand: boring, painfull, not for me.

The lazy way is to use 2 softwares: ImageMagick and Potrace.

The conversion process is to convert from PNG to PNM then from PNM to SVG.

First step done with ImageMagick:

convert image.png image.pnm

Second step done with Potrace:

potrace -s -o image.svg image.pnm

And finally you can remove temp pnm file.

I found a small and usefull bash script to do that in a gist from Yrjö Kari-Koskinen (ykarikos on github). Thanks to him!

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *