Skip to content

Pure Go implementation of Potrace vectorization library

License

Notifications You must be signed in to change notification settings

prolicht-dev/gotrace

Repository files navigation

GoTrace

Pure Go implementation of Potrace vectorization library. Supports simple SVG output generation.

Original image

Original

Vectorized image

Vectorized

Installation

go get github.com/dennwc/gotrace

Usage

Process image, generate SVG:

paths, _ := gotrace.Trace(img, nil)
gotrace.WriteSvg(file, img.Bounds(), paths, "")

Custom threshold function:

params := gotrace.Defaults()
params.ThresholdFunc = func(c color.Color) bool {
  r,g,b,_ := c.RGBA()
  return r+g+b > 128
}
paths, _ := gotrace.Trace(img, params)

About

Pure Go implementation of Potrace vectorization library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 56.9%
  • Go 41.6%
  • C++ 1.5%