Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 761 Bytes

README.md

File metadata and controls

34 lines (27 loc) · 761 Bytes

GoTrace

Go bindings for Potrace vectorization library. Supports simple SVG output generation.

Original image

Original

Vectorized image

Vectorized

Installation

apt-get install libpotrace-dev
go get github.com/dennwc/gotrace/bindings

Usage

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)