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

Incorrect Box2f metadata #1943

Open
markdjwilliams opened this issue Dec 16, 2024 · 1 comment
Open

Incorrect Box2f metadata #1943

markdjwilliams opened this issue Dec 16, 2024 · 1 comment

Comments

@markdjwilliams
Copy link

The following code demonstrates an issue where writing or reading a Box2f attribute into an EXR's metadata fails:

import OpenEXR
import numpy as np

metadata = {
    "test_box2i": ((0, 0), (1, 1)),
    "test_box2f": ((0.0, 0.0), (1.0, 1.0)),
}

image = OpenEXR.Part(
    header={
        "compression": OpenEXR.ZIP_COMPRESSION,
        "type": OpenEXR.scanlineimage,
        "test_box2f": ((0.0, 0.0), (1.0, 1.0)),
        "test_box2i": ((0, 0), (1, 1)),        
    },
    channels={
        "R": np.zeros((128, 128), dtype=np.float32),
        "G": np.zeros((128, 128), dtype=np.float32),
        "B": np.zeros((128, 128), dtype=np.float32),
    },
)

f = OpenEXR.File([image])
f.write("metadata.exr")

The relevant lines of output from exrheader metadata.exr show that the box2i is written correctly, but the value for the box2f is wrong:

test_box2f (type box2f): (3.40282e+38 3.40282e+38) - (-3.40282e+38 -3.40282e+38)
test_box2i (type box2i): (0 0) - (1 1)
@cary-ilm
Copy link
Member

Thanks for the catch, there was a glitch in the test as well as the code. Fixed in #1944.

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

2 participants