Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageMagick Command Line convert PNG to EPS with Transparency

I am trying to do a simple conversion from a transparent PNG file to EPS with transparency and currently my command looks like this:

convert "image1.png" "image1.eps"

It looks like all I am getting is a black image. Any ideas?

Thanks!

like image 850
Tom Pennetta Avatar asked Nov 03 '22 00:11

Tom Pennetta


1 Answers

Converting a PNG to an EPS is more than just a simple format conversion. Its changing from a raster image to a vector image, so the raster image has to be "traced". The popular command line tool for doing this is potrace. With potrace installed (and its component tool mkbitmap) you could do it with something like this:

convert image1.png image1.bmp
mkbitmap image1.bmp -o image1.pgm
potrace image1.pgm -e -o image1.eps

The call to mkbitmap converts the color image to a graymap more suitable for tracing. This will yield an eps with black lines on a white background. If you need a full color trace, inkskape is a GUI tool for doing this, and an inkscape user homebrewed a command line tool to do it, which can be found here

like image 128
chiliNUT Avatar answered Nov 11 '22 09:11

chiliNUT