Skip to main content

High-performance camera film simulation filters

Project description

saturnix-filter

High-performance camera film simulation filters in Rust, designed for the SATURNIX open-source camera (Raspberry Pi Zero 2W).

Developed to accelerate on-device photo processing, saturnix-filter delivers a ~41x to ~91x speedup over traditional pure-Python image processing on the target Raspberry Pi Zero 2 W hardware by leveraging zero-copy in-memory pixel manipulation, 10-bit fixed-point integer math, and multicore scaling via Rayon.

Features

  • Zero-Copy Memory Model: Manipulates Pillow image bytes directly in memory space
  • Parallel Execution: Distributes row-by-row pixel computations across all available CPU cores using rayon.
  • 26 Complete Film Styles:
    • S-Gold (Kodak Gold warm vintage style)
    • S-Vivid (Kodak Ektar ultra-saturated style)
    • S-Natural (Fujifilm organic greens style)
    • S-Saturnix (Signature cel-animation glow style)
    • S-MonoX (Kodak Tri-X 400 panchromatic S-curve B&W style)
    • S-Portra (Kodak Portra 400 soft, warm skin-tone style)
    • S-Cinestill (Cinestill 800T cool tungsten / teal-shadow style)
    • S-Cross (Cross-processed E-6-in-C-41 high-contrast style)
    • S-Faded (Sun-faded vintage print with milky lifted blacks)
    • S-Bleach (Bleach-bypass desaturated high-contrast silver style)
    • S-Sepia (Warm brown-toned B&W)
    • S-Cyano (Cool blue Cyanotype-toned B&W)
    • S-Noir (High-contrast neutral B&W with heavy vignette)
    • S-Teal (Cinematic teal-and-orange style)
    • S-Lomo (Lomography toy-camera oversaturated style)
    • S-Fuji (Fujifilm Velvia high-saturation landscape style)
    • S-Selenium (Cool selenium-toned B&W)
    • S-Platinum (Warm, soft platinum-print-toned B&W)
    • S-Infrared (Aerochrome-style false-colour infrared)
    • S-SplitTone (Cinematic warm-highlight / cool-shadow split-toning)
    • S-Kodachrome (Rich, warm vintage-slide style)
    • S-Polaroid (Instant-film look with milky blacks and cyan cast)
    • S-Matrix (Digital-dystopia green cast)
    • S-Cine (Filmic S-curve digital-cinema grade)
    • S-Leak (Warm light-leak flare from the corner)
    • S-Halation (Warm red-orange glow blooming from highlights)
    • VHS (Vintage VHS tape simulation)

Examples

Each column is one source photo; each row is the same image with a filter applied.

Sample 01 Sample 02 Sample 03 Sample 04
Original
S-Gold
S-Vivid
S-Natural
S-Saturnix
S-MonoX
S-Portra
S-Cinestill
S-Cross
S-Faded
S-Bleach
S-Sepia
S-Cyano
S-Noir
S-Teal
S-Lomo
S-Fuji
S-Selenium
S-Platinum
S-Infrared
S-SplitTone
S-Kodachrome
S-Polaroid
S-Matrix
S-Cine
S-Leak
S-Halation
VHS

Installation

Install the precompiled binary wheel directly from PyPI (no compiler required on the Raspberry Pi!):

pip install saturnix-filter

The core install has no Python dependencies — ideal for the production runtime on the Raspberry Pi. To also get the saturnix-filter command-line tool for experimenting on a PC (image file conversion, gallery rendering), install the optional cli extra:

pip install "saturnix-filter[cli]"

Usage

from PIL import Image
import saturnix_filter

# 1. Load an image as RGB
img = Image.open("photo.jpg").convert("RGB")
width, height = img.size

# 2. Extract mutable bytearray (Zero-Copy pointer reference)
buf = bytearray(img.tobytes())

# 3. Apply the filter instantly inside RAM
# Supported options: "S-Gold", "S-Vivid", "S-Natural", "S-Saturnix", "S-MonoX",
#                    "S-Portra", "S-Cinestill", "S-Cross", "S-Faded", "S-Bleach",
#                    "S-Sepia", "S-Cyano", "S-Noir", "S-Teal", "S-Lomo", "S-Fuji",
#                    "S-Selenium", "S-Platinum", "S-Infrared", "S-SplitTone",
#                    "S-Kodachrome", "S-Polaroid", "S-Matrix", "S-Cine",
#                    "S-Leak", "S-Halation", "VHS"
saturnix_filter.apply_film_inplace(buf, width, height, "S-Saturnix")

# 4. Re-construct the Pillow image from the modified buffer
filtered_img = Image.frombytes("RGB", (width, height), bytes(buf))
filtered_img.save("photo_filtered.jpg", "JPEG", quality=92)

Command-line tool

With the cli extra installed, the saturnix-filter command converts image files directly:

# Apply a filter (auto-names the output photo_s-gold.jpg next to the input)
saturnix-filter convert photo.jpg -f S-Gold

# Several filters and/or images at once, downscaled to 1200 px wide
saturnix-filter convert *.jpg -f S-Gold -f S-Halation --max-width 1200

# List every available filter with a description
saturnix-filter list

# Apply every filter to one image, rendering a gallery next to it
saturnix-filter gallery photo.jpg

Performance Comparison

All numbers are pure in-memory processing times at full 16 MP camera resolution (4656 x 3496 pixels), measured with a warm-up pass and excluding file I/O. saturnix-filter uses the optimized 10-bit fixed-point integer implementation.

Hardware: Raspberry Pi Zero 2 W (ARM Cortex-A53 quad-core @ 1.0 GHz)

Filter Original Python saturnix-filter Speedup
S-Gold 16.729 s 0.375 s ~44.6x
S-Vivid 16.711 s 0.405 s ~41.3x
S-Natural 16.702 s 0.374 s ~44.7x
S-Saturnix 32.083 s 0.392 s ~81.9x
S-MonoX 31.841 s 0.350 s ~91.0x
VHS 18.452 s 0.351 s ~52.5x

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saturnix_filter-0.2.0.tar.gz (10.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

saturnix_filter-0.2.0-cp39-abi3-win_amd64.whl (226.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (368.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (361.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

saturnix_filter-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (319.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

saturnix_filter-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (323.8 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file saturnix_filter-0.2.0.tar.gz.

File metadata

  • Download URL: saturnix_filter-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for saturnix_filter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 140caa07e578cc3c3140675f911c9410d6c54a89b72ae11c4e4b57b9324677ba
MD5 13e8a7b149d57821934a3e2e294376e6
BLAKE2b-256 0e0745e6bdca7464c6cb6633430b2298b4b9b3517f205b9ddb262ef8942114ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0.tar.gz:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file saturnix_filter-0.2.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for saturnix_filter-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9363e882ac9975308d2df94c5d7785294dbdda5d960ce71f31a4cbdbb6dadb10
MD5 93c8bbfceeda98f321cdf7487acc4e27
BLAKE2b-256 a67129fa2301efbae527c56c46bc42a09332cf2772dbdab2a9ee892c3e1419b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82230c15b2b3f7aad9cdf09c1643414bd0abe20959f34cd068595a052f3d3d06
MD5 67b1bfe64e93003e10f73b4bd870a39c
BLAKE2b-256 14eacd3e18b14c7d60e9ec948500d68a8d508fdd8da65ffccf80b6c668aaddd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22d21120890b6c2a87cebb1b9c65774cfcedccbec2c9456aa04835999780bb6b
MD5 bc3a46df165706f6d52f0683676581eb
BLAKE2b-256 babc8947c1aca141a78cf5c39fd5fd68451b2ec7726084bc240c46aedd7aacc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file saturnix_filter-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for saturnix_filter-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5829a2e520a38960d81f004baa3c34596e204f50b70fb7b7883f7914e1f97b8a
MD5 c94912dfc1d719b652a31f78cd1c864c
BLAKE2b-256 355749c6868ecb923f7d8e23500be94a5d898199fd3762b52643009b6064b459

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file saturnix_filter-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for saturnix_filter-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e9edfe1dec934c79a94c906f2cfae6f92f71f8a23f08910489f61bbc060800e8
MD5 e24e520ecdfa1c2ed963c6704f3bb43e
BLAKE2b-256 afb5f6260d7a9e79e03385184f84a59f6348e2d0627bc211b97358f5a90b0755

See more details on using hashes here.

Provenance

The following attestation bundles were made for saturnix_filter-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on oberbichler/saturnix-filter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page