Python bindings for AutoTrace.
Install PyAutoTrace using your package manager of choice.
uv add pyautotrace[standard]python -m pip install pyautotrace[standard]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.svgSee the contribution guide for instructions to build PyAutoTrace from source.
- Tests
This project is licensed under the LGPLv2.1 license.
See the documentation for details about the licenses of upstream and included code.