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.2.0.tar.gz (16.8 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.2.0-cp39-abi3-win_amd64.whl (552.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

exrio-0.2.0-cp39-abi3-win32.whl (538.5 kB view details)

Uploaded CPython 3.9+Windows x86

exrio-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (754.5 kB view details)

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

exrio-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (809.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

exrio-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (673.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for exrio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4c3bde59bc2eeb5246088855f63fb83c486e5113267f6f0135d8278c7abce090
MD5 630e88e44d419e5d66b55c933f8738f6
BLAKE2b-256 827e38f7c18e4ff5d02226020aa5b9c9836c68a68783dbc2289a8e73dc7564a6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: exrio-0.2.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 552.2 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.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0ccab6798d71829e8a1ce677a141190beed8a0ec92d3b67bede6629bee2d58c3
MD5 16c8f942dff501ea8ab1a39a32f2365d
BLAKE2b-256 df28d75aaed96903e4c3762fdadbcb6503a3ef3151ae56ff6e899bb1cee90a17

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: exrio-0.2.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 538.5 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.2.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 d03d4bf0b61c91c2de34266a8fa7d13e9551a9218c62b4765b8decbd9ee16fce
MD5 bd5f13f17ead24beb28f10bdc107036b
BLAKE2b-256 962e089826343e68c2b3c7d9ec1da8df901df358bee309dd6fec26f705ce248a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exrio-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9f5ab3d3d87a5f32516c9ff4c9e157231887c301598a916958830281862d694
MD5 fb14c92bf13fd654b568fe5b0664aeb0
BLAKE2b-256 9a489ff52ca565832dcfe993476bed5a55d3ea95ff20529cbe8b88b1592b4383

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exrio-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b9afda311d761749abac13f3d705a13c153bfe056764321ca240abd0772a9474
MD5 8f699083f6bfb5fef7f2c31a0008ceff
BLAKE2b-256 85a51c496b9a6aeb17eb7ed33c7b76b1e715413b0fd593dcaf6bc5dfe828e470

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: exrio-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 673.1 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.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1cfa7ccc5f1f820fb6bfbec42ee117baad9f00cb1335433d3cf2efffc569462f
MD5 2504def1592fbf4bcbf528868add3be4
BLAKE2b-256 1120d38e462d44f987a2d770a2d823b9ac610b4022f8cebcb7ca8cb6f52cd88e

See more details on using hashes here.

Provenance

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