Skip to main content

A tool to convert raster images of glyphs into vector paths using Bezier curves.

Project description

Glyphtracy: A raster to vector conversion library

Glyphtracy Logo

Glyphtracy is a raster to vector conversion library focused on high-quality curve fitting and node placement for font design.

This module provides the main Vectorizer class which implements the full pipeline of contour extraction, node identification, path segment creation, and curve fitting. It also includes a command-line interface for processing images and outputting SVG paths along with detailed debug information.

The Vectorizer class is highly configurable with parameters for tuning node placement sensitivity, curve fitting tolerance, and handle balancing. The output includes both the final SVG path and a structured debug payload containing details of the contours, nodes, and segments for further analysis or visualization.

Usage:

glyphtracy input_image.png --output output_image.svg --debug-json debug_output.json

The debug JSON file contains a detailed breakdown of the contours, nodes, and segments identified and created during the vectorization process, which can be used for debugging or visualization purposes.

A debugging viewer is available at debugger/split_debug_viewer.html that can load the debug JSON output and visualize the contours, nodes, and segments interactively.

Open this HTML file in a web browser, and load the generated debug_output.json to see the results of the vectorization process, including the identified nodes and fitted segments overlaid on the original contours.

Programmatic usage:

from glyphtracy import Vectorizer

vectorizer = Vectorizer(
    image_source="input_image.png",
    sharp_threshold=math.radians(30),
    pixel_tolerance=1.5,
    # ... - see Vectorizer.__init__ for all parameters
)
final_path, debug_data = vectorizer.run()
# final_path is a BezPath object representing the vectorized image
# debug_data is a structured dictionary containing details of contours, nodes, and segments for debugging/visualization

License

Glyphtracy is licensed under the Apache License 2.0. See the LICENSE.txt file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glyphtracy-0.1.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glyphtracy-0.1.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file glyphtracy-0.1.0.tar.gz.

File metadata

  • Download URL: glyphtracy-0.1.0.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for glyphtracy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a7e64c10c1128ef2d88a91de0e2684d7f1da91a25dded7fc866ef938831049a
MD5 cbafe95a47f91e03bc765e38ef26089a
BLAKE2b-256 150d9682ed1afa5dde842ebd243d5d8da71f782d8a50c37a072324c61d6947b4

See more details on using hashes here.

File details

Details for the file glyphtracy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glyphtracy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for glyphtracy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e208947de6f643e6c2d6abacd7a71ddc04a8b3c89ebdba24289ce49b13120f70
MD5 3c12e3114b745c9c9a0553f3883daedb
BLAKE2b-256 1a272d93c1fc1afb922b2002d8bd640cdde33a0b4439ce39bf09e8f50f6f3586

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page