Skip to content

A bitmap vectorizer that can trace along the centerline of a stroke. The builtin inkscape 'trace bitmap' can only trace edges, thus resulting in double lines for most basic use cases. It uses 'autotrace -centerline' and an optimal threshold to vectorize a pixel image.

License

Notifications You must be signed in to change notification settings

nexlab/inkscape-centerline-trace

 
 

Repository files navigation

inkscape-centerline-trace

A bitmap vectorizer that can trace along the centerline of a stroke. The builtin inkscape 'trace bitmap' can only trace edges, thus resulting in double lines for most basic use cases.

Download Source code and Debian/Ubuntu package

Written with python-Pillow. It uses 'autotrace -centerline' and an optimal threshold to vectorize a pixel image. See centerline-tracing.svg for an illustration of the idea.

In inkscape it shows up under Extensions -> Images -> Centerline Trace ...


Algorithm: The input image is converted to a graymap and histogram normalized with PIL.ImageOps.autocontrast. Optional preprocessing: equal illumination, median denoise filter.

Autotrace needs a bi-level bitmap. In order to find the best threshold value, we can run autotrace at multiple thresholds and evaluate the result candidates.

We count the number of line segments produced and measure the total path length drawn. The svg that has the longest path but the least number of segments is returned.

About

A bitmap vectorizer that can trace along the centerline of a stroke. The builtin inkscape 'trace bitmap' can only trace edges, thus resulting in double lines for most basic use cases. It uses 'autotrace -centerline' and an optimal threshold to vectorize a pixel image.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • NSIS 71.8%
  • Python 23.9%
  • Shell 3.9%
  • Makefile 0.4%