Home

Awesome

ril-py

Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust.

What's this?

This is a python binding around ril designed to provide an easy-to-use, high-level interface around image processing in Rust. Image and animation processing has never been this easy and fast before.

Support

⚠ This package is a work in progress and it heavily depends on the progress of ril

By the first stable release, we plan to support the following image encodings:

Encoding FormatCurrent Status
PNG / APNGSupported
JPEGSupported
GIFSupported
WebPCan't support (#8)
BMPNot yet supported
TIFFNot yet supported

Installation

Prebuilt wheels

There will be prebuilt wheels for these platforms:

If you want another platform to have prebuilt wheels, please open an issue.

CPython 3.11 support will be available once its ABI has been stabilized.

If your platform has prebuilt wheels, installing is as simple as

pip install ril

Building from Source

In order to build from source, you will need to have the Rust compiler available in your PATH. See documentation on https://rust-lang.org to learn how to install Rust on your platform.

Then building is as simple as

pip install ril

or from Github

pip install git+https://github.com/Cryptex-github/ril-py

Pip will handle the building process.

Examples

Open an image, invert it, and then save it:

from ril import Image

image = Image.open("example.png")
image.invert()

image.save("example.png")

Create a new black image, open the sample image, and paste it on top of the black image:

from ril import Image, Pixel

image = Image.new(600, 600, Pixel.from_rgb(0, 0, 0))
image.paste(100, 100, Image.open("sample.png"))

image.save("sample_on_black.png", "PNG") # You can also specify format if you like