Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

Overview

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

**This package is published on pypi under the name pyril due to a pypi limitation.

It will be published under ril in the future, if possible.

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 pyril

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 pyril

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
You might also like...
A performant terminal-based project editor with extensive shortcuts
A performant terminal-based project editor with extensive shortcuts

omega A performant and extensive terminal-based project editor with a wide variety of modern shortcuts. How to use omega [path] This section will guid

Demo app duplicated in 5 languages (Go/JavaScript/Python/Ruby/Rust) showing how to go from source code to container image using melange+apko

hello-melange-apko đź’« This repo contains an example app duplicated across 5 languages showing how to: Package source code into APKs using melange Buil

A GSL (the GNU Scientific Library) binding for Rust

rust-GSL A Rust binding for the GSL library (the GNU Scientific Library). The minimum support Rust version is 1.54. Installation This binding requires

Simple, extensible multithreaded background job processing library for Rust.
Simple, extensible multithreaded background job processing library for Rust.

Apalis Apalis is a simple, extensible multithreaded background job processing library for Rust. Features Simple and predictable job handling model. Jo

Concurrent and multi-stage data ingestion and data processing with Rust+Tokio

TokioSky Build concurrent and multi-stage data ingestion and data processing pipelines with Rust+Tokio. TokioSky allows developers to consume data eff

Background task processing for Rust applications with Tokio, Diesel, and PostgreSQL.
Background task processing for Rust applications with Tokio, Diesel, and PostgreSQL.

Async persistent background task processing for Rust applications with Tokio. Queue asynchronous tasks to be processed by workers. It's designed to be

Shaping, Processing, and Transforming Data with the Power of Sulfur with Rust
Shaping, Processing, and Transforming Data with the Power of Sulfur with Rust

Sulfur WIP https://www.youtube.com/watch?v=PAAvNmoqDq0 "Shaping, Processing, and Transforming Data with the Power of Sulfur" Welcome to the Sulfur pro

Fast & Memory Efficient NodeJs Excel Writer using Rust Binding

FastExcel This project need Rust to be installed, check here for Rust installation instruction This project using Rust and Neon as a binding to Rust t

.NET PhysX 5 binding to all platforms(win, osx, linux) for 3D engine, deep learning, dedicated server of gaming.
.NET PhysX 5 binding to all platforms(win, osx, linux) for 3D engine, deep learning, dedicated server of gaming.

MagicPhysX .NET PhysX 5 binding to all platforms(win-x64, osx-x64, osx-arm64, linux-x64, linux-arm64) for 3D engine, deep learning, dedicated server o

Comments
  • Update pyo3 requirement from 0.16 to 0.17

    Update pyo3 requirement from 0.16 to 0.17

    Updates the requirements on pyo3 to permit the latest version.

    Release notes

    Sourced from pyo3's releases.

    PyO3 0.17.1

    This release contains some minor bug fixes for PyO3 0.17.0. In particular the new PyDictItems, PyDictKeys and PyDictValues types are actually accessible!

    Thanks to @​davidhewitt, @​messense and @​PrettyWood for the fixes.

    Changelog

    Sourced from pyo3's changelog.

    [0.17.1] - 2022-08-28

    Fixed

    • Fix visibility of PyDictItems, PyDictKeys, and PyDictValues types added in PyO3 0.17.0.
    • Fix compile failure when using #[pyo3(from_py_with = "...")] attribute on an argument of type Option<T>. #2592
    • Fix clippy redundant-closure lint on **kwargs arguments for #[pyfunction] and #[pymethods]. #2595

    [0.17.0] - 2022-08-23

    Packaging

    • Update inventory dependency to 0.3 (the multiple-pymethods feature now requires Rust 1.62 for correctness). #2492

    Added

    • Add timezone_utc. #1588
    • Implement ToPyObject for [T; N]. #2313
    • Add PyDictKeys, PyDictValues and PyDictItems Rust types. #2358
    • Add append_to_inittab. #2377
    • Add FFI definition PyFrame_GetCode. #2406
    • Add PyCode and PyFrame high level objects. #2408
    • Add FFI definitions Py_fstring_input, sendfunc, and _PyErr_StackItem. #2423
    • Add PyDateTime::new_with_fold, PyTime::new_with_fold, PyTime::get_fold, and PyDateTime::get_fold for PyPy. #2428
    • Accept #[pyo3(name)] on enum variants. #2457
    • Add CompareOp::matches to implement __richcmp__ as the result of a Rust std::cmp::Ordering comparison. #2460
    • Add PySuper type. #2486
    • Support PyPy on Windows with the generate-import-lib feature. #2506
    • Add FFI definitions Py_EnterRecursiveCall and Py_LeaveRecursiveCall. #2511
    • Add PyDict::get_item_with_error. #2536
    • Add #[pyclass(sequence)] option. #2567

    Changed

    • Change datetime constructors taking a tzinfo to take Option<&PyTzInfo> instead of Option<&PyObject>: PyDateTime::new, PyDateTime::new_with_fold, PyTime::new, and PyTime::new_with_fold. #1588
    • Move PyTypeObject::type_object method to the PyTypeInfo trait, and deprecate the PyTypeObject trait. #2287
    • Methods of Py and PyAny now accept impl IntoPy<Py<PyString>> rather than just &str to allow use of the intern! macro. #2312
    • Change the deprecated pyproto feature to be opt-in instead of opt-out. #2322
    • Emit better error messages when #[pyfunction] return types do not implement IntoPy. #2326
    • Require T: IntoPy for impl<T, const N: usize> IntoPy<PyObject> for [T; N] instead of T: ToPyObject. #2326
    • Deprecate the ToBorrowedObject trait. #2333
    • Iterators over PySet and PyDict will now panic if the underlying collection is mutated during the iteration. #2380
    • Iterators over PySet and PyDict will now panic if the underlying collection is mutated during the iteration. #2380
    • Allow #[classattr] methods to be fallible. #2385
    • Prevent multiple #[pymethods] with the same name for a single #[pyclass]. #2399
    • Fixup lib_name when using PYO3_CONFIG_FILE. #2404
    • Add a message to the ValueError raised by the #[derive(FromPyObject)] implementation for a tuple struct. #2414
    • Allow #[classattr] methods to take Python argument. #2456
    • Rework PyCapsule type to resolve soundness issues: #2485
      • PyCapsule::new and PyCapsule::new_with_destructor now take name: Option<CString> instead of &CStr.

    ... (truncated)

    Commits
    • caaf7bb release: 0.17.1
    • 511303a Merge pull request #2599 from davidhewitt/no-main-gh-pages
    • 3e15bb9 gh-pages: stop building guide for main
    • 9e9e913 Merge pull request #2595 from davidhewitt/kwargs-clippy
    • 058af11 pyfunction: fix clippy lint on **kwargs argument
    • 73c8532 Merge pull request #2592 from davidhewitt/issue-2280
    • 9d543b3 pyfunction: fix from_py_with on Option<T> argument
    • f927cdb Merge pull request #2558 from mejrs/cargo
    • 611ecc1 fix: export new dict views types (#2590)
    • c28e919 Merge pull request #2589 from davidhewitt/netlify-redirects
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Webp support

    Webp support

    I can't link libwebp statically into the final binary built for the wheel, so webp won't be supported until either I somehow figured out how to link it within the binary, or ril uses other solution.

    help wanted 
    opened by Cryptex-github 0
  • Build aarch64-apple-darwin wheels natively

    Build aarch64-apple-darwin wheels natively

    Build aarch64-apple-darwin wheels natively to reduce CI time because cross-compiling is generally slower.

    This is currently being blocked by

    • [ ] https://github.com/actions/runner-images/issues/2187
    • [ ] https://github.com/github/roadmap/issues/528
    opened by Cryptex-github 1
Releases(v0.4.0)
A user-friendly, lightweight TUI for disk imaging

Caligula Burning Tool Caligula is a user-friendly, lightweight TUI for imaging disks. $ caligula burn -h Burn an image to a disk Usage: caligula burn

Astrid Yu 25 Mar 26, 2023
The high-speed IAPWS-IF97 package in Rust with C and Python binding

SEUIF97 This is the Rust implementation of the high-speed IAPWS-IF97 package seuif97 with C and Python binding. It is suitable for computation-intensi

Cheng Maohua 5 Aug 12, 2023
Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

consumet-rs 5 Aug 13, 2023
Save image from your clipboard 📋 as an image file directly from your command line! 🔥

Clpy ?? Save copied image from clipboard as an image file directly from your command line! Note It works only on windows as of now. I'll be adding sup

Piyush Suthar 13 Nov 28, 2022
A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use

A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use. The language is designed to be simple and easy to use. It is inspired by rust syntax and is statically typed. The syntax will be extended in the future to support more features.

null 13 Oct 28, 2023
high-level API for reaper-rs

rea-rs Easy to use ReaScript API. While reaper-rs is full-implemented at low-level, and, partially implemented at medium-level, on top of it (mostly,

Timofey Kazantsev 6 Dec 26, 2022
High-performance, low-level framework for composing flexible web integrations

High-performance, low-level framework for composing flexible web integrations. Used mainly as a dependency of `barter-rs` project

Barter 8 Dec 28, 2022
A high-level, ergonomic crate for interacting with the UploadThing API

utapi-rs A high-level, ergonomic Rust crate for interacting with the Uploadthing API. Why? If you're using Rust and want to use Uploadthing for file u

Ivan Leon 4 Feb 2, 2024
Schemars is a high-performance Python serialization library, leveraging Rust and PyO3 for efficient handling of complex objects

Schemars Introduction Schemars is a Python package, written in Rust and leveraging PyO3, designed for efficient and flexible serialization of Python c

Michael Gendy 7 Nov 21, 2023
qsv - Performant CLI tool to query CSVs through SQL

qsv Performant CLI tool to query CSVs through SQL Installation After cloning the repository, you can install a binary locally using cargo install --pa

Dermot Haughey 3 Oct 28, 2021