Skip to main content

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 file
  • FileNotFoundError: 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 file
  • img (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


Download files

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

Source Distribution

simple_exr-0.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

simple_exr-0.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

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

Hashes for simple_exr-0.0.0.tar.gz
Algorithm Hash digest
SHA256 ec915395acfb116e05f08e9efcc73fbf26d33eb7ff539d82e40e2195fffe3e48
MD5 8730c757fb666253dc491f26579ffd63
BLAKE2b-256 79b2c7e75f074f723c5e89a19960934c219d532d6b3fe38d956be72ea4dc73d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_exr-0.0.0.tar.gz:

Publisher: publish.yml on iamNCJ/simple-exr

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

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

Hashes for simple_exr-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd4d886bfce82f7b5f618c9f854388c7e347d42b1bd14ee6986fe91b58bc2022
MD5 eb330e0d4bed4ecae187989f08b222a0
BLAKE2b-256 c0f7adb8c825334a2ed736b982cbb28f3f95be2759c1ac18303c70bdb6dddedb

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_exr-0.0.0-py3-none-any.whl:

Publisher: publish.yml on iamNCJ/simple-exr

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