toonz-engine
Headless OpenToonz 1.8.0 engine wrapper for studio centre-line vectorization, PLI export, and FX.
Headless Python driver for the real OpenToonz 1.8.0 studio engine, extracting variable-width .pli strokes, generating compact --direct-quads SVGs, and rendering procedural ambient FX and .tnz scenes.
git clone https://github.com/BestRoiMedia/anim-toolkit.gitWhy we built it
OpenToonz's built-in ToonzScript SVG export collapses strokes to a single average width, losing the expressive variable line weight of its centre-line vectorizer. We built toonz_engine to run OpenToonz headlessly, save native .pli files, parse every control point's thickness directly in Python, and emit compact variable-width SVGs and ambient FX loops.
Architecture & how it works
toonz_engine/cli.py drives a private OpenToonz engine installation (configured via setup or TOONZ_ENGINE_HOME) in a single batch ToonzScript invocation per directory. It reads binary .pli stroke records via pli.py, preserves wide dark masses in the paint layer, and optionally emits --direct-quads quadratic-offset SVG paths (~40% smaller than refitted cubics). It also wraps tcomposer for .tnz scene rendering and includes a procedural ambient FX generator (toonz_engine/fx/) for seamless candle, rain, fog, dust, and ember loops.
Key capabilities
- Batch headless OpenToonz centre-line vectorization (~1-2 s warm per directory)
- Native .pli binary reader preserving per-point stroke thickness (pli2svg)
- Compact --direct-quads SVG ink export and wide-dark-fix paint preservation
- Compatible *.strokes.json output for keylib and toonz-vector match/inbetween
- Headless tcomposer scene rendering and procedural seamless ambient FX recipes (fx/)
Usage example
python3 anim/toonz_engine/cli.py doctor
python3 anim/toonz_engine/cli.py vectorize ./frames_2_5x --out ./vec --out-scale 2.5 --direct-quads --keep-pli
python3 anim/toonz_engine/cli.py pli2svg ./vec/000.pli --canvas 512 512 --out ./vec/000_check.svg