How to correctly using potrace (CLI) to trace bitmap

I was trying to vectorize a .png. I found a utility (which is incorporated into InkScape), the potrace. If any of you knows how to use potrace, kindly teach me the right way to get sharp output.

Consider this input (png).

enter image description here

To use potrace, the picture must be in bitmap format. So I converted it by using imagemagick.

convert image.png image.bmp

Then I proceeded with potrace.

potrace --svg falcon.bmp -o falcon.svg

But unfortunately, the output looks obviously dull.

enter image description here

I don’t really understand the options (potrace -h). Or if there’s a better alternative other than potrace, just tell me.

Answer

Tracing with BirdFont

The potrace algorithm is good but no autotrace algorithm is perfect.

I had a similar problem when I tried to auto trace letters with potrace. Small details are not preserved and the result seems to be a little bit smoother than I wanted it to be. I solved this by implementing my own autotrace functionality in BirdFont. It seems to work a little bit better but it is not as fast as the potrace algorithm.

The image looks like this when converted to black and white:
Image before tracing it

And the traced result looks like this:
Vector graphics automatically generated from the raster image.

This image was generated with the following settings:

  • Cubic Beziér paths
  • Contrast: 0.59
  • Amount of details: 3.0
  • Simplification: 0.1

BirdFont is a font editor and TTF is the most common font format fonts but you can export the generated image as SVG.

Edit->Export Glyph as SVG

You can find more instructions on the autotrace functionality at the BirdFont website.

Attribution
Source : Link , Question Author : Aizan Fahri , Answer Author : Paolo Gibellini

Leave a Comment