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

Add proper python support for reading/writing header only #1813

Open
cary-ilm opened this issue Sep 4, 2024 · 3 comments
Open

Add proper python support for reading/writing header only #1813

cary-ilm opened this issue Sep 4, 2024 · 3 comments
Labels
good first issue Possible one-day project for somebody new help wanted

Comments

@cary-ilm
Copy link
Member

cary-ilm commented Sep 4, 2024

Currently, constructing a File with header_only=true simply skips the reading of channel data, so a subsequent write doesn't do the right thing. Ideally, the write would do a block copy of the channel data from the old file to the new.

@cary-ilm cary-ilm added good first issue Possible one-day project for somebody new help wanted labels Sep 4, 2024
@skurmedel
Copy link
Contributor

skurmedel commented Oct 22, 2024

Hi Cary, I could take a look at this if you don't mind. Technically it wouldn't be my first contribution to OpenEXR but it would probably a bit more meaningful than fixing a typo :)

@cary-ilm
Copy link
Member Author

Yes, thank you!

Check out what exrstdattr does, in src/bin/stdattr/main.cpp. It calls copyPixels() on the output part. You'll want to do something similar, but it will mean keeping track of the input part in a way the existing code does not.

@skurmedel
Copy link
Contributor

skurmedel commented Oct 25, 2024

Hi again. I made myself familiar with the code, and I made some progress on this.

However, I have a question about PyFile::parts, the current code indicates to me that one is not supposed to alter the references in PyFile::parts. Is this correct? Perhaps I've just missed some part of the documentation.

If I get a OpenEXR.File from somewhere, I can replace or add parts, as it is a standard Python list. For example, file.parts[0] = OpenEXR.Part(...) or file.parts.append(OpenEXR.Part()). But part indices of a PyFile are set through a private mechanism, at least from the Python users view.

The reason I ask is because if one replaces a part in PyFile::parts as above, we would sort of lose track of the source part. I guess one could check the references and detect that this has happened, but if modifying PyFile::parts this way is unsupported, then I could go for a much simpler mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Possible one-day project for somebody new help wanted
Projects
None yet
Development

No branches or pull requests

2 participants