white or black only) as the input format. Here is an example that uses the -flatten flag on convert to handle this: sudo apt-get install potrace imagemagickĪnother interesting phenomenon is that you can use PPM (256*3 colors, ie. See also this good comparison of raster to vector converters on Wikipedia.Ī note to those using potrace and imagemagick, converting PNG images with transparency to PPM doesn't seem to work very well. If you want to convert many files, you can also use the following one-line command: ( set -x for f_png in *.png do f='$' convert '$f_png' '$f.pnm' & potrace '$f.pnm' -s -o '$f.svg' done ) Potrace '$File.pnm' -s -o '$File.svg' # PNM to SVG Ykarikos proposes a script png2svg.sh that I have improved: #!/bin/bashĮcho >&2 'The first argument ($File_png)'Įcho >&2 'must be a file having a size greater than zero'Ĭonvert '$File_png' '$File.pnm' # PNG to PNM Temporary file = 2017.pnm potrace 2017.pnm -s -o 2017.svg potrace -o file.svg => Write output to file.svg.Potrace file.pnm -s -o file.svg # PNM to SVG Therefore, first convert from PNG to PNM: convert file.png file.pnm # PNG to PNM Potrace does not support PNG as input file, but PNM.