Kornia rebuilds its engine room in Rust
To give computer vision pipelines a Rust foundation for thread-safe image I/O and tensor ops without abandoning Python's ecosystem.

What it does
kornia-rs handles low-level computer vision grunt work—reading and writing images in over a dozen formats, resizing, color conversion, and basic tensor manipulation—all in Rust. It exposes a Python interface via PyO3 that returns numpy arrays and DLPack tensors, letting you slot the results directly into PyTorch pipelines.
The interesting bit
Instead of treating Rust as a separate ecosystem, the library uses it as a drop-in replacement for Python’s I/O and preprocessing bottlenecks. The Python API even mimics PIL’s ergonomics and supports uint16 depth maps via PNG-16, while the Rust side splits into focused sub-crates for 3D vision, AprilTags, and visual language models.
Key highlights
- Reads and writes AVIF, JPEG (via libjpeg-turbo), OpenEXR, WebP, and roughly a dozen other formats
- Thread-safe architecture, including support for Python’s free-threaded builds
- Modular crate system:
kornia-io,kornia-imgproc,kornia-3d,kornia-apriltag, and others can be used independently - Python
Imageclass supports nativeuint16for depth maps and scientific imagery, with in-memory PNG-16 encoding - SIMD-accelerated resizing and PyTorch interoperability via DLPack
Caveats
- The Python bindings expose only a subset of the Rust API, so advanced features may require writing Rust
- Optional system dependencies like GStreamer, Video4Linux, and turbojpeg can complicate builds depending on feature flags
Verdict
Best suited for data scientists and ML engineers who need thread-safe, efficient preprocessing without leaving numpy-land. Rust developers can use the native crates directly, though the project’s center of gravity clearly leans toward Python interoperability.
Frequently asked
- What is kornia/kornia-rs?
- To give computer vision pipelines a Rust foundation for thread-safe image I/O and tensor ops without abandoning Python's ecosystem.
- Is kornia-rs open source?
- Yes — kornia/kornia-rs is open source, released under the Apache-2.0 license.
- What language is kornia-rs written in?
- kornia/kornia-rs is primarily written in Rust.
- How popular is kornia-rs?
- kornia/kornia-rs has 680 stars on GitHub.
- Where can I find kornia-rs?
- kornia/kornia-rs is on GitHub at https://github.com/kornia/kornia-rs.