kymostudio-core (Rust)
Pure-Rust SVG → PNG rasterizer core for kymostudio, built on
resvg. No browser, no headless Chrome,
no C/Cairo/Skia system dependencies.
One core crate, compiled to four targets from a single source via feature
flags — so the Rust CLI, the Python package, and the JS/browser playground all
share the exact same resvg engine (resvg is CSS-class-aware, the reason the
project avoids cairosvg):
| Target | Feature | Build tool | Consumer |
|---|---|---|---|
Native lib + kymo CLI |
system-fonts (default) |
cargo |
standalone CLI |
| Python extension (abi3) | python |
maturin → wheel |
packages/python |
| wasm (browser + Node) | wasm |
wasm-pack → pkg |
packages/js, website playground |
svg_to_png(svg: &[u8], scale: f32) -> Result<Vec<u8>, RenderError> is the one
core function; each binding (src/python.rs, src/wasm.rs) is a thin façade.
CLI — kymo
| Flag | Meaning |
|---|---|
-i, --input <FILE> |
Input SVG (required) |
-o, --output <FILE> |
Output PNG (or pass it positionally) |
-s, --scale <N> |
Scale factor, 1.0 = intrinsic size (default 1) |
-h, --help / -V, --version |
Help / version |
Build each target
# Native (CLI + lib + tests)
# Python wheel (abi3, one wheel for CPython ≥ 3.10)
# import _kymostudio_core; _kymostudio_core.svg_to_png(svg_bytes, scale)
# wasm (browser + Node) — system-fonts OFF (no fs/mmap on wasm)
# import { svgToPng } from './pkg/kymostudio_core.js'
CI builds and smoke-tests all of the above across Linux/macOS/Windows —
see .github/workflows/rust.yml.
Library use (Rust)
let svg = read?;
let png: = svg_to_png?;
write?;
The version is kept in lockstep with the rest of the monorepo
(Cargo.toml → version).