pillow-rs¶
Latest release: 12.2.0-alpha.1.
Rust image processing with a familiar Python PIL interface and one npm package
for Node.js and browsers. This alpha supports common image operations;
check compatibility before replacing Pillow.
Documentation · Supported APIs · Benchmark results
Install¶
| Your application | Package manager | Guide |
|---|---|---|
| Python | pip: pillow-rs; import PIL |
Python installation |
| Node.js or browser | npm: pillow-rs |
JavaScript quickstart |
| Rust | Cargo: pillow-rs; import pillow_rs |
Rust quickstart |
For Python, create a fresh environment. Pillow and pillow-rs both provide PIL,
so install them in separate environments.
python3 -m venv .venv
.venv/bin/python -m pip install pillow-rs==12.2.0-alpha.1
On Windows, use .venv\Scripts\python.exe instead of .venv/bin/python.
See installation requirements for supported platforms.
Make your first image¶
from io import BytesIO
from PIL import Image, ImageOps
image = Image.new("RGB", (3, 2), (255, 12, 34))
image = ImageOps.mirror(image).resize((6, 4))
output = BytesIO()
image.save(output, format="PNG")
assert image.size == (6, 4)
assert output.getvalue().startswith(b"\x89PNG\r\n\x1a\n")
This creates, mirrors, resizes, and encodes an RGB image entirely in memory. Continue with Python recipes.
What can I use?¶
- Create, read, save, crop, resize, rotate, and convert images.
- Use supported drawing, filtering, color, palette, and statistics operations.
- Load fonts and render text within the documented font limitations.
- Use the compatibility guide to check modes, formats, and unsupported integrations.
The version prefix identifies the targeted Pillow version. It does not promise complete Pillow compatibility or stable alpha APIs.
Performance¶
View benchmark results for per-workload comparisons. Each result identifies whether it measures the current release or an older revision; performance depends on the input and hardware.
Contribute and get help¶
Contributing covers source builds, tests, and benchmark development. Support · Security · Releases · Changelog · Code of conduct
See LICENSE for terms.
Acknowledgements¶
Thank you to Puhu for the Rust/Python image processing work that informed the early exploration of this project, and to Pillow and its contributors for the image library, public API, and reference behavior on which the compatibility work depends.