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.1.tar.gz (16.3 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.1-cp39-abi3-win_amd64.whl (551.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

exrio-0.1.1-cp39-abi3-win32.whl (537.9 kB view details)

Uploaded CPython 3.9+Windows x86

exrio-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (754.0 kB view details)

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

exrio-0.1.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (808.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

exrio-0.1.1-cp39-abi3-macosx_11_0_arm64.whl (672.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: exrio-0.1.1.tar.gz
  • Upload date:
  • Size: 16.3 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.1.tar.gz
Algorithm Hash digest
SHA256 4dcfb3e8944938d99e9b15837ae1f45a520515bffdbe5a451793987114a1cb98
MD5 b78193b6c2c7d524e39217c005f0fcb3
BLAKE2b-256 7a391e14863b920cb35427da01f0194cc14e0fdf5767a2b1b4670db283eb8496

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1.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.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: exrio-0.1.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 551.7 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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4f0a44a0a39db2035338d3765fabffb2c0ad0ea6b52a8ce4f5fa0f4cce13bd55
MD5 2bb125d57f831f0b456048639ac3e78b
BLAKE2b-256 2d6118157ee78aadcea46b045a4f534fc27962ab1d4bd56e87309b51740b9941

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1-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.1-cp39-abi3-win32.whl.

File metadata

  • Download URL: exrio-0.1.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 537.9 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.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 09eafa80be2ffd23088b2a1640f4a0e8bca9bbe5fb8abb437c768cb6790a7b04
MD5 0a63bbefbfec206cf8c31089311948c7
BLAKE2b-256 eb541ef92c61d8ed34ecff4518a6e99da2c6d5b13ce62adcd3532c2d0bc24491

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1-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.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for exrio-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c54b97f624551b66f3ef736e2095dc47529574e7c6a489be3d6cb20eb74ad4f
MD5 3b776cbac6b7abb8a2098fe87ddc10dd
BLAKE2b-256 49bacefd23350682ff48d23e71801a0323e53c88621c15cfb86198e7ba13b864

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1-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.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for exrio-0.1.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 90f897cddbfba8ca94c16f31b407cce207aa3fe6307fe74c30a2b8cf44321720
MD5 24be9c141251d7894e286be2368e244d
BLAKE2b-256 be017bd32c62c659a911623765036fcba169eb2748b6446c98e74827536c23ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1-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.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: exrio-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 672.3 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.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76de92013daf2a4260b9bf90a89855bb75014edfdf8c490c16b18bdb28074041
MD5 fd27a220f29ed6b0b90847df9cc40bed
BLAKE2b-256 310e18bf1cbb575ba1eb85e12605e1f27214e817f2586404580a0b28320be6ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for exrio-0.1.1-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