How to convert pixel (raster) files (png) to vector graphic (svg) on Linux

In another post I wrote about the small tool convert as part of imagemagick. With convert it is possible to, surprisingly enough, convert picture files. ASAIK it would not convert to or from vector graphics, though.

From the man-pages of inkscape:

Inkscape can import (File > Import) most bitmap formats (PNG, BMP, JPG, XPM, GIF etc.), plain text (requires Perl), and AI format (Adobe Illustrator documents, versions up to 7 only;
requires Perl).

Unfortunatelly it only works via the GUI. You need to either open, import or drag’n’drop the png file, mark it and go to the menu “Path” and than trace it via “Trace Bitmap…”. You might also want to set the output dimensions vie the File menu and “Document Properties” to 48×48 or similar if you are working on an icon. In my tests though, the output was rather crappy. Fortunately I found the original postscript of the program icon (foobar2000 it was).

If you need the other way around, i.e. vector  -> raster, there is a comand line argument to be used like this:

inkscape filename.svg --export-png=filename.png

See more details at examples in man pages of inkscape.

Update: And there is also Potrace and Delineate.

Resources:

4 Comments

  1. Anibal said,

    Friday, 30th Oct 2009 at 13:43

    Thank! Good tip! Better conversion than Imagemagick.

  2. Federico said,

    Wednesday, 14th May 2008 at 13:55

    You should take a look at autotrace too!

  3. Dirk Gently said,

    Tuesday, 4th Mar 2008 at 03:11

    Really very very cool. After months of opening gimp to convert one single image, I learned about imagemagick. Now I can do the same thing with svg’s.

    Thanks.

  4. alagan said,

    Saturday, 27th Oct 2007 at 08:10

    Thanks for valuable information


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: