One tracer, four ways to call it
The command-line tool, the Go library, the HTTP API and the WebAssembly build are one codebase with one set of options. Pure Go, no cgo, one dependency.
Command line
A single static binary for Linux, macOS, Windows and FreeBSD, on amd64 and arm64. Install it with a package manager, or download it from the releases page.
# macOS and Linux
brew tap vexyl-ai/tap && brew trust vexyl-ai/tap && brew install --cask rekha
# Windows
scoop bucket add vexyl-ai https://github.com/vexyl-ai/scoop-bucket && scoop install rekha
# Debian, Ubuntu, Fedora, RHEL: add the repository at vexyl-ai.github.io/packages, then
sudo apt install rekha # or: sudo dnf install rekha
# With Go 1.26 or later
go install github.com/vexyl-ai/rekha/cmd/rekha@latest
Each preset seeds every other setting, and any flag you give overrides it. Output goes next to the input unless you say otherwise.
rekha image.png # writes image.svg
rekha --auto logo.png # try four settings, keep the closest
rekha --preset poster --refine logo.png # flat colours, refined curves, primitives
rekha --preset photo --gradients artwork.jpg # smooth shading as gradient fills
rekha -o out.svg --threshold auto scan.png # black and white, automatic threshold
rekha --preset poster --palette "#000000,#ff0000,#ffffff" logo.png
rekha -o logo.pdf --preset poster logo.png # PDF or EPS from the extension
rekha --mode polygon - < in.png > out.svg # stdin to stdout
rekha --help # every flag, range and default
Exit codes: 0 for success, 1 for a usage error, 2 when a trace failed. The remaining inputs are still processed.
Hosted API
Everything the studio does, the API does. Sign in to the studio, create a key, and send it as the bearer token. Options are the command-line flags in camelCase, as form fields or query parameters.
curl -H "Authorization: Bearer rk_your_key" \
-F image=@logo.png -F auto=true \
https://app.rekhasvg.com/v1/trace > logo.svg
# A raw body works too, with options in the query string
curl -H "Authorization: Bearer rk_your_key" -H "Content-Type: image/png" \
--data-binary @logo.png \
"https://app.rekhasvg.com/v1/trace?preset=photo&gradients=true&format=pdf" > logo.pdf
- Input
- PNG, JPEG or GIF, as multipart form data with a file field named
image, or as a raw body with animage/*content type. - Output
formatissvg,pdf,epsordxf. The response headers report the path count and the time taken.- Limits
- Your plan's image size and daily traces. See pricing.
- Errors
- JSON of the form
{"error": "…"}: 400 for a bad option or image, with the field named; 413 for an image over the limit; 429 when the day's traces are used.
Go library
One call traces an image into paths and gradients; a second writes the SVG. Segmentation and curve fitting are separate steps, so a cached segmentation can be re-fitted with new curve options.
package main
import (
"image/png"
"os"
"github.com/vexyl-ai/rekha"
)
func main() {
f, _ := os.Open("logo.png")
img, _ := png.Decode(f)
o := rekha.PresetOptions(rekha.PresetPoster)
o.Refine.Enabled = true
res, err := rekha.Trace(img, o)
if err != nil {
panic(err)
}
out, _ := os.Create("logo.svg")
defer out.Close()
res.WriteSVG(out, o)
}
Regions decided elsewhere, by a segmentation model, a matte or a hand selection, go in as external masks, and a progress callback reports each stage. The full reference is on pkg.go.dev.
Self-hosted service
The open-source server puts the tracer behind HTTP with caps on request size, pixels, time, concurrency and queue length, so one client cannot exhaust the host.
docker run --rm -p 8080:8080 ghcr.io/vexyl-ai/rekha
curl -F image=@logo.png -F preset=poster -F refine=true localhost:8080/v1/trace > logo.svg
Running it as a service for others brings the AGPL's source obligation with it. A commercial licence removes that.
Browser and WebAssembly
The tracer compiles to a 1.2 MB gzipped WebAssembly module that runs in a Web Worker, at a median of 4.5 times the single-core native time. Images traced this way never leave the page. The open-source browser build is the place to try it, and the embedding notes are in the repository.
Read the source
The tracer, its tests and its benchmarks are all in one repository.