Skip to content

pillow-rs

CI Documentation Benchmarks Release Latest release Sponsor

Latest release: 12.2.3.

Rust image processing with Python's familiar PIL interface and a shared WebAssembly package for Node.js and browsers. The project supports a selected set of Pillow-compatible APIs; check the supported APIs and limitations before replacing Pillow.

Documentation ยท Supported APIs

Install

Your application Package manager Guide
Python pip install pillow-rs; import PIL Installation
Node.js or browser npm install pillow-rs JavaScript quickstart
Rust Cargo dependency pillow-rs; import pillow_rs Rust quickstart

For Python, use a fresh environment. Pillow and pillow-rs both provide the PIL namespace, so install them in separate environments.

python3 -m venv .venv
.venv/bin/python -m pip install pillow-rs==12.2.3

On Windows, use .venv\Scripts\python.exe instead of .venv/bin/python. See installation requirements for supported platforms and the optional Parallel CPU package.

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 in memory. Continue with Python recipes.

Supported behavior

The supported surface includes image creation and file I/O, geometry and mode conversion, drawing, filters, color operations, palettes, statistics, and font rendering. Availability depends on the API, mode, format, and platform; the compatibility guide lists the supported combinations and known limits. The version prefix targets Pillow 12.2.0 and does not promise complete Pillow compatibility.

Contribute and get help

Contributing covers building the project and proposing changes. For help, see support, security reporting, releases, and the changelog.

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.