



1024x1024), you can resize that down to pretty much any size you want in GIMP. If someone sends you a large, high resolution file (e.g. svg (vector) can be a pain if you are not very familiar with the tools available, or if you are not a graphic designer by trade.

svg, you may not have to go through the trouble. the following use PBM: sudo apt-get install potrace imagemagickĭepending on why you want to convert from. You can switch between the three by changing the file extension, ie. Presumably this is the difference between a pixel > (256 / 2) test and a pixel > 0 test. From my limited observations, it would appear that on images which are anti-aliased, PPM and PGM (which produce identical SVGs as far as I can see) shrink the colored area and PBM expands the colored area (albeit only a little). 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.
