Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Latest commit

 

History

History

bindings

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)