MCPcopy Index your code
hub / github.com/asze17/ril-py

github.com/asze17/ril-py @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
172 symbols 240 edges 13 files 15 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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 Format Current Status
PNG / APNG Supported
JPEG Supported
GIF Supported
WebP Not yet supported
BMP Not yet supported
TIFF Not yet supported

Installation

Prebuilt wheels

There will be prebuilt wheels for these platforms:

  • Linux x86-64: Cpython 3.7, 3.8, 3.9, 3.10, PyPy 3.7, 3.8, 3.9
  • MacOS x86-64: Cpython 3.7, 3.8, 3.9, 3.10, PyPy 3.7, 3.8, 3.9
  • Windows x86-64: Cpython 3.7, 3.8, 3.9, 3.10, PyPy 3.7, 3.8, 3.9
  • Linux i686: Cpython 3.7, 3.8, 3.9, 3.10, PyPy 3.7, 3.8, 3.9
  • MacOS aarch64: Cpython 3.8, 3.9, 3.10

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

Core symbols most depended-on inside this repo

mode
called by 6
src/image.rs
cast_pixel_to_pyobject
called by 4
src/utils.rs
dimensions
called by 4
src/workaround.rs
get_pixel
called by 4
src/image.rs
set_settings
called by 3
src/workaround.rs
from_rgb
called by 2
src/pixels.rs
new
called by 2
src/workaround.rs
push_segment
called by 2
src/workaround.rs

Shape

Method 135
Class 18
Function 12
Enum 7

Languages

Rust97%
Python3%

Modules by API surface

src/text.rs34 symbols
src/workaround.rs31 symbols
src/image.rs30 symbols
src/draw.rs28 symbols
src/sequence.rs18 symbols
src/pixels.rs14 symbols
src/types.rs8 symbols
test/test_image.py3 symbols
test/conftest.py2 symbols
src/error.rs2 symbols
src/utils.rs1 symbols
src/lib.rs1 symbols

For agents

$ claude mcp add ril-py \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact