Skip to main content

Read and write OpenEXR files in Python with no system dependencies.

Project description

exrio

Fast and dependency-free python library for reading and writing OpenEXR files.

Installation

pip install exrio

Usage

Read an EXR file from disk (sRGB)

from exrio import load

image = load("path/to/image.exr")
pixels = image.to_pixels()

Read an EXR file from memory (ACES 2065-1)

import boto3
from exrio import ExrImage

s3 = boto3.client("s3")
buffer = s3.get_object(Bucket="bucket-name", Key="path/to/image.exr")["Body"].read()
image = ExrImage.from_buffer(buffer)
pixels = image.to_pixels()

print(f"Red Chromaticity: {image.chromaticities.red}")
print(f"Green Chromaticity: {image.chromaticities.green}")
print(f"Blue Chromaticity: {image.chromaticities.blue}")

Write an EXR file (sRGB)

image = ExrImage.from_pixels(pixels)
image.to_path("path/to/output.exr")

Write an EXR to S3 (ACEScg)

image = ExrImage.from_pixels_ACEScg(pixels)
s3 = boto3.client("s3")
s3.put_object(Bucket="bucket-name", Key="path/to/output.exr", Body=image.to_buffer())

Read a Custom Multi-Layer EXR

from exrio import load

image = load("path/to/image.exr")
print(f"Attributes: {image.attributes}")
print(f"Chromaticities: {image.chromaticities}")

for layer in image.layers:
    print(f"Layer: {layer.name}")
    print(f"  Width: {layer.width}")
    print(f"  Height: {layer.height}")
    print(f"  Attributes: {layer.attributes}")

    for channel in layer.channels:
        print(f"    Channel: {channel.name}")
        print(f"      Pixels: {channel.pixels.shape}, dtype: {channel.pixels.dtype}")

Write a Custom Multi-Layer EXR

from exrio import ExrImage, ExrLayer, ExrChannel

pixels = np.random.rand(1920 * 1080).astype(np.float32)

channels = [
    ExrChannel(name="R", width=1920, height=1080, pixels=pixels),
    ExrChannel(name="G", width=1920, height=1080, pixels=pixels),
    ExrChannel(name="B", width=1920, height=1080, pixels=pixels),
]
mask = ExrChannel(name="A", width=1920, height=1080, pixels=pixels)
layer = ExrLayer(name="color", width=1920, height=1080, channels=channels)
mask_layer = ExrLayer(name="mask", width=1920, height=1080, channels=[mask])
chromaticities = Chromaticities(red=(0.68, 0.32), green=(0.265, 0.70), blue=(0.15, 0.06))
image = ExrImage(layers=[layer, mask_layer], chromaticities=chromaticities)
image.to_path("path/to/output.exr")

Development

Install Tools

Run Tests

uv sync
uv run pytest

Run Examples

uv sync
uv run examples/test.py

Publish

Create an account on test.pypi.org and register your GitHub OIDC provider on Publishing.

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

exrio-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distributions

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

exrio-0.1.0-cp39-abi3-win_amd64.whl (550.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

exrio-0.1.0-cp39-abi3-win32.whl (537.1 kB view details)

Uploaded CPython 3.9+Windows x86

exrio-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (753.4 kB view details)

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

exrio-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (808.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

exrio-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (671.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file exrio-0.1.0.tar.gz.

File metadata

  • Download URL: exrio-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for exrio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 980efe079fa0696b2152bb8b3dc6d4f898c919479bc5a7eea0d3215e7337a681
MD5 4067dae1bb2a49670ab57c1730706cff
BLAKE2b-256 6e0fab5cf80562e0daa6ba1766a8773086b34f6c3b408cc4c0fca0f95d16ca6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0.tar.gz:

Publisher: publish.yml on patrickhulce/exrio

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

File details

Details for the file exrio-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: exrio-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 550.8 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for exrio-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d7f4e2a5bbdb54918f1fa389c816f8d9ce9c4838a70d961967e57e9f504fac3a
MD5 77d2df3c0c4f9ee3a2aa697378f6ec36
BLAKE2b-256 4bc0973a470d474e47f19a731f0ad289fcab42a35effc33bb4212e0f0c164719

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on patrickhulce/exrio

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

File details

Details for the file exrio-0.1.0-cp39-abi3-win32.whl.

File metadata

  • Download URL: exrio-0.1.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 537.1 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for exrio-0.1.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 d6ae1e0e61f247016b95cc422d304187627d7461fadacb3ef72d5d3e6c3f916c
MD5 fe0741568697474a0f37ce5f8c9fe847
BLAKE2b-256 a88849cf301a7f3ccc9f5dad2e08170f6047f86cbe35c2e88df072a1f816fc30

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0-cp39-abi3-win32.whl:

Publisher: publish.yml on patrickhulce/exrio

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

File details

Details for the file exrio-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for exrio-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7ad8f6cd9f70aa1cf021c551d37a106f4a954cb84690ff03bfb10340e4e3243
MD5 6a54a901e8cd5093b754947da7601bb7
BLAKE2b-256 4ff78fd9b90eecf25e049133f1519108e64c65f059d92e6803c36833ffc0811f

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on patrickhulce/exrio

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

File details

Details for the file exrio-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for exrio-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f23e26dc20fa660d197efc5fd9f109b2b3f1ea81f212dd623ed0ac5d83582011
MD5 efe271691569af223468f29c9da65679
BLAKE2b-256 55e8356ca5102ffdd54cfc4c2784f8f03a7a346eafa79eb7490c1c61a55f3bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: publish.yml on patrickhulce/exrio

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

File details

Details for the file exrio-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: exrio-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 671.6 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for exrio-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3562d2061d23c22f05f1ae348f510d6d67a5d24384202eef2dfcd0f40cf5d5a0
MD5 dd6b970881a608bd507d8f063503d73e
BLAKE2b-256 085c0f334d2081620d0e8e7f4fb0e26260212f680c2472c05a6752fe9600f36b

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on patrickhulce/exrio

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