Go bindings for Potrace vectorization library. Supports simple SVG output generation.
Original image
Vectorized image
apt-get install libpotrace-dev
go get github.com/dennwc/gotrace/bindings
Process image, generate SVG:
paths, _ := gotraceb.Trace(img, nil)
gotraceb.WriteSvg(file, img.Bounds(), paths, "")
Custom threshold function:
params := gotraceb.Defaults()
params.ThresholdFunc = func(c color.Color) bool {
r,g,b,_ := c.RGBA()
return r+g+b > 128
}
paths, _ := gotraceb.Trace(img, params)