Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to write a bigger image? #1715

Open
hroskes opened this issue Apr 9, 2024 · 0 comments
Open

Is there any way to write a bigger image? #1715

hroskes opened this issue Apr 9, 2024 · 0 comments

Comments

@hroskes
Copy link
Contributor

hroskes commented Apr 9, 2024

I'm trying to write some large images using Python. I have this code, based on the example in the docs.

import OpenEXR, Imath
import numpy as np

width = 32768
height = width
dtype = np.float32

h = OpenEXR.Header(width,height)
h['channels'] = {'R' : Imath.Channel(Imath.PixelType(Imath.PixelType.FLOAT))} 
o = OpenEXR.OutputFile("hello.exr", h)
r = np.zeros(shape=(height,width), dtype=dtype)
r[height//2-100:height//2+100,width//2-100:width//2+100] = 3.4
channels = {'R' : r.tobytes()}

o.writePixels(channels)
    
o.close()

It gives me

TypeError                                 Traceback (most recent call last)
Cell In[6], line 16
     13 r[height//2-100:height//2+100,width//2-100:width//2+100] = 3.4
     14 channels = {'R' : r.tobytes()}
---> 16 o.writePixels(channels)
     18 o.close()

TypeError: Data for channel 'R' should have size 0 but got 4294967296

For smaller width, it works fine. I guess it's some kind of limit on the size dtype used internally somewhere. Is there a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant