How visioncortex/vtracer works
Project type and purpose
• This is a multi-target vectorization tool built around a core Rust library (vtracer).
• It exposes three front ends:
• A command-line application (cmdapp)
• A Python extension via PyO3
• A Web application (webapp) compiled to WebAssembly and wrapped by JavaScript/HTML
• There is also a static documentation site in the docs/ folder.
File structure
• Top level:
• Cargo.toml – workspace containing the core library and possibly sub-crates
• cmdapp/ – Rust crate for the CLI and Python bindings
• webapp/ – Rust crate plus JS/HTML for the browser UI
• docs/ – prebuilt HTML/CSS/JS assets for documentation
• cmdapp/src holds modules: config.rs, converter.rs, python.rs (bindings), svg.rs
• webapp/src holds modules: canvas.rs, svg.rs, conversion pipeline (binary_image.rs, color_image.rs), utils.rs
• Build/deployment:
• GitHub Actions workflows for Python, Rust, and release
• pyproject.toml for Python packaging
• package.json and webpack.config.js for bundling the Web UI
README for additional insights
• Core functionality: raster→vector conversion using an O(n) tracing and clustering pipeline
• Interfaces: CLI flags, Rust library API, Python pip package, WebAssembly
• Dependencies: visioncortex core library, wasm-pack/webpack, PyO3
Elements
• From each front end → Core Library (indicating API calls)
• Within Core: Config → Clustering → Fitting → SVG Output
• Web UI: HTML/JS → WASM → Canvas Rendering
• Another for JS/HTML/Web assets
• Another for Python extension
• Optionally, a highlight for build/deploy flows (CI pipelines)