A simple library for reading and writing EXR files
Project description
Simple EXR
A simple Python library for reading and writing OpenEXR files using numpy arrays.
Installation
pip install simple-exr
Quick Start
Reading EXR Files
import simple_exr
import numpy as np
# Read an EXR file
image = simple_exr.read_exr("path/to/image.exr")
print(f"Image shape: {image.shape}") # (height, width, channels)
print(f"Image dtype: {image.dtype}") # float32
Writing EXR Files
import simple_exr
import numpy as np
# Create a sample RGB image
height, width = 512, 512
rgb_image = np.random.rand(height, width, 3).astype(np.float32)
# Write to EXR file
simple_exr.write_exr("output.exr", rgb_image)
# Create a sample RGBA image
rgba_image = np.random.rand(height, width, 4).astype(np.float32)
# Write RGBA to EXR file
simple_exr.write_exr("output_rgba.exr", rgba_image)
API Reference
read_exr(path: str) -> np.ndarray
Read an EXR file and return it as a numpy array.
Parameters:
path(str): Path to the EXR file
Returns:
np.ndarray: Image data as (H, W, C) array where C is 3 (RGB) or 4 (RGBA)
Raises:
ValueError: If no RGB(A) channels are found in the EXR fileFileNotFoundError: If the file doesn't exist
write_exr(path: str, img: np.ndarray)
Write a numpy array to an EXR file as RGB or RGBA depending on channel count.
Parameters:
path(str): Output path for the EXR fileimg(np.ndarray): Image data with shape (H, W, 3) or (H, W, 4), dtype float32 or float64
Raises:
ValueError: If img doesn't have 3 or 4 channels
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_exr-0.0.0.tar.gz.
File metadata
- Download URL: simple_exr-0.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec915395acfb116e05f08e9efcc73fbf26d33eb7ff539d82e40e2195fffe3e48
|
|
| MD5 |
8730c757fb666253dc491f26579ffd63
|
|
| BLAKE2b-256 |
79b2c7e75f074f723c5e89a19960934c219d532d6b3fe38d956be72ea4dc73d2
|
Provenance
The following attestation bundles were made for simple_exr-0.0.0.tar.gz:
Publisher:
publish.yml on iamNCJ/simple-exr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_exr-0.0.0.tar.gz -
Subject digest:
ec915395acfb116e05f08e9efcc73fbf26d33eb7ff539d82e40e2195fffe3e48 - Sigstore transparency entry: 577081117
- Sigstore integration time:
-
Permalink:
iamNCJ/simple-exr@4de23eb8a22dd5016f0e4c50cff1084bccbc5047 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iamNCJ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4de23eb8a22dd5016f0e4c50cff1084bccbc5047 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_exr-0.0.0-py3-none-any.whl.
File metadata
- Download URL: simple_exr-0.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd4d886bfce82f7b5f618c9f854388c7e347d42b1bd14ee6986fe91b58bc2022
|
|
| MD5 |
eb330e0d4bed4ecae187989f08b222a0
|
|
| BLAKE2b-256 |
c0f7adb8c825334a2ed736b982cbb28f3f95be2759c1ac18303c70bdb6dddedb
|
Provenance
The following attestation bundles were made for simple_exr-0.0.0-py3-none-any.whl:
Publisher:
publish.yml on iamNCJ/simple-exr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_exr-0.0.0-py3-none-any.whl -
Subject digest:
bd4d886bfce82f7b5f618c9f854388c7e347d42b1bd14ee6986fe91b58bc2022 - Sigstore transparency entry: 577081133
- Sigstore integration time:
-
Permalink:
iamNCJ/simple-exr@4de23eb8a22dd5016f0e4c50cff1084bccbc5047 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iamNCJ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4de23eb8a22dd5016f0e4c50cff1084bccbc5047 -
Trigger Event:
workflow_dispatch
-
Statement type: