Skip to content

lemonyte/pyautotrace

PyAutoTrace

Python bindings for AutoTrace.

Installation

Install PyAutoTrace using your package manager of choice.

uv add pyautotrace[standard]
python -m pip install pyautotrace[standard]

Usage

import numpy as np
from autotrace import Bitmap, VectorFormat
from PIL import Image

# Load an image.
image = np.array(Image.open("image.jpeg").convert("RGB"))

# Create a bitmap.
bitmap = Bitmap(image)

# Trace the bitmap.
vector = bitmap.trace()

# Save the vector as an SVG.
vector.save("image.svg")

# Get an SVG as a byte string.
svg = vector.encode(VectorFormat.SVG)

Or use the provided CLI:

pyautotrace in.png out.svg

Building

See the contribution guide for instructions to build PyAutoTrace from source.

TODO

  • Tests

License

This project is licensed under the LGPLv2.1 license.

See the documentation for details about the licenses of upstream and included code.

Packages

 
 
 

Contributors