0

I have some compressed EXR scan-line files that are unable to be read using minexr (shows error assert self.compr == 0x00, 'Compression not supported.'). Additionally, I want to read them one scanline at a time, so as to not overload memory. On the internet, I can not find out how to do this. Any ideas? Here's my code so far:

from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import minexr
import os

ETC_PATH = Path(__file__).parent / 'etc'

os.chdir(r"C:\Users\DELL\Documents\Quixel\Trial task for hire evaluation\test1")

def main():
    with open('u1_v1.exr', 'rb') as fp:
        reader = minexr.load(fp)

UPDATE:

I'm now using OpenEXR, however OpenEXR in Python has different classes and methods than in the documentation s. How would I use OpenEXR to read the exr file one scaneline at a time? This is my updated code:

import sys
import array
import OpenEXR
import Imath

if len(sys.argv) != 3:
    print "usage: exrnormalize.py exr-input-file exr-output-file"
    sys.exit(1)

# Open the input file
file = OpenEXR.InputFile(sys.argv[1])

# Compute the size
dw = file.header()['dataWindow']
sz = (dw.max.x - dw.min.x + 1, dw.max.y - dw.min.y + 1)

# Read the three color channels as 32-bit floats
FLOAT = Imath.PixelType(Imath.PixelType.FLOAT)
(R,G,B) = [array.array('f', file.channel(Chan, FLOAT)).tolist() for Chan in ("R", "G", "B") ]

0 Answers0