I have a PNG file that contains some B/W lines, e.g.,

enter image description here

I would now like to trace those lines to get an SVG file. When using Inkscape to trace, it'll always return the lines as 2D plastic objects:

enter image description here

I would like the lines to be just SVG lines with some thickness, though.

Any hints on how to achieve this?

1 Answer 1


Inkscape can do this:

  • Import the PNG and select it
  • go to the menu Path / Trace Bitmap
  • choose Centerline tracing

You can see that it works by setting a different contour color ("set stroke") and changing the line thickness:

Contour tracing

black: original PNG
pink: line with thickness 0.1 mm
blue: line with thickness 2.0 mm

To be honest, I seldom do it this way, because IMHO the results are not good.

  1. Looking at the original picture, I would expect 4 objects: one banana-like shape and three strokes. Inkscape will give you one object only.
  2. Even if the result were different objects, Inkscape thinks of different objects than me. Look at the details of the topmost crossing:

No crossing where a crossing is expected

So what I actually do is draw the lines by myself. The result is often much smoother, uses less nodes, is easier to modify later and typically better represents the objects.

Comparison with self-drawn result

black: original PNG
pink: auto-traced, line thickness 0.1 mm
green: hand crafted, note how it has less artifacts, straighter lines and smoother curves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.