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.