Skip to main content

tikra: TikZ to SVG and PNG, no TeX install

tikra

TikZ and pgfplots figures to SVG and PNG, without a TeX install: no LaTeX, no fonts on the system, no external processes. Math in labels is typeset by mathra. Try it in the browser.

pip install tikra

Wheels for Linux, macOS and Windows, for Python 3.9 and later; nothing else to install.

Usage

import tikra

svg = tikra.tikz_to_svg(r"""
\begin{tikzpicture}
  \draw[->] (0,0) -- (2,1) node[right] {$\vec v$};
\end{tikzpicture}
""")
open("v.svg", "w", encoding="utf-8").write(svg)
open("v.png", "wb").write(tikra.png(svg, dpi=300))

r = tikra.render(r"\tikz \draw (0,0) circle (1);")
r["warnings"]      # [] — what tikra skips or approximates is listed here, and the rest is drawn
tikz_to_svg(code) The SVG as a string.
render(code) A dict: svg and warnings (a list of strings).
png(svg, *, dpi=300, background=True) PNG bytes; background=False keeps it transparent instead of white.

code is a full standalone document, a bare tikzpicture, an inline \tikz, an axis environment or loose TikZ statements. Errors (no figure in the input, an invalid dpi, a PNG past 100 megapixels) are ValueError. Types are included (py.typed).

What it draws

Every image below is an SVG written by tikra from a figure in the repository's corpus, on a white card.

Triangle with an angle arc and a height
Triangle with an angle arc and a height
Unit circle with polar points
Unit circle with polar points
pgfplots: expressions, marks and a legend
pgfplots: expressions, marks and a legend
Flowchart with positioning
Flowchart with positioning
zigzag, snake and random steps
zigzag, snake and random steps
Bar chart from a foreach
Bar chart from a foreach

Paths, nodes and shapes, positioning and calc, \foreach, scopes and styles, xcolor, arrow tips, patterns, decorations and pgfplots basics. What tikra does not understand becomes a warning, never a failure: the full subset is in spec/subset.md.

Also for JavaScript, Rust and the terminal

The same core is an npm package (@mathlabs/tikra), a Rust crate and a command-line tool: github.com/matheusmota-dev-br/tikra.

License

The code is MIT or Apache-2.0; the STIX Two Math font embedded through mathra is under the SIL Open Font License 1.1.

Metadata

Release files for tikra 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tikra 1.0.0
File Size Uploaded Provenance
tikra-1.0.0.tar.gz 65.9 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for tikra 1.0.0
File
tikra-1.0.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
tikra-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
tikra-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
tikra-1.0.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
tikra-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 10.9 MB

Release files / tikra-1.0.0.tar.gz

Download URL tikra-1.0.0.tar.gz
Size 65.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5aad1135dec9d8cccc66fcd3a5a4468d059ec21708a0547942cecb382a33e895
BLAKE2b-256 checksum
How to use checksums
81c7e6ac80157e1b7334d175783730c9127b56f82ed8a35f0e3883adda2eb0f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tikra-1.0.0-cp39-abi3-win_amd64.whl

Download URL tikra-1.0.0-cp39-abi3-win_amd64.whl
Size 2.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
062f13df4b95fdaa4890ab0c36b491e1174051f0f0f51d11621963a21438d003
BLAKE2b-256 checksum
How to use checksums
bcf7145e70ca2042f9aa6cc78785cc44cc684e8e001e3715ca9aa744505a30d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tikra-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tikra-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
308598b51231d74e4c1285568dec0332fcc58d0af226af781d5910aec951675a
BLAKE2b-256 checksum
How to use checksums
27683378028ef4fc971713148761ca4cf79e6e565a624bf105e63542857fea83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tikra-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL tikra-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a445acc1a6afb424f2cbf20c7eb4ecccbb881824b8a340271d71cade01a89858
BLAKE2b-256 checksum
How to use checksums
291c413f2a4f0e51618e06b7fc9441041fdc611c9dec6b071489ce67ece44532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tikra-1.0.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL tikra-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
29c02cd58c346ab90a9b7becf1c7531b1179836e83cb831f33dd68706ccd2f78
BLAKE2b-256 checksum
How to use checksums
c0627a965c56349f9d3b28713f00c49299a2bd8b3bba6b0c8a1cb2b762370422
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tikra-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL tikra-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.2 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
49878ec7478da7b7c11e0182af500707ea43f234bf0187fa8b90f842c60345d3
BLAKE2b-256 checksum
How to use checksums
23ac7f94693230ba30a516462983723b20eb4cc10e72cb5df686343c6240897f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for tikra 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for tikra-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page