Skip to content

Python bindings for AutoTrace, a bitmap to vector conversion library.

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE.txt
LGPL-2.1
LICENSE-autotrace.txt
Notifications You must be signed in to change notification settings

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

No packages published

Contributors 4

  •  
  •  
  •  
  •