Skip to content

added Endianness access from IFD to python #106

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

feefladder
Copy link
Contributor

@feefladder feefladder commented Jun 14, 2025

closes #91 No unit tests yet. There were none before me in the Python part. Would be happy to add some with some pointers.

I chose to duplicate the enum in Python, so users can access it as Endianness.LittleEndian in Python as well, using pyo3 macro derivation.

I added the repr(u16) and custom discriminant on PyEndianness for matching tiff structure. I could reflect that in src/reader.rs::Endianness or drop completely.

It seems that FromPyObject trait impl is needed if we want to pass it into a rust function from the python side. Since we don't currently do that, I didn't implement it. Could be nicely done to accept all of Endianness, u16 or String I think?

I'm a bit unsure of the location of PyEndianness Since its an enum I put it in python/src/enums.rs, even though all enums there are tags. On the rust side Endianness is in reader.rs, which makes sense implementation-wise I think? Should it actually be in python/src/reader.rs? Or should we wait for repo layout (#69).

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

Successfully merging this pull request may close these issues.

Add endianness property to the TIFF class
1 participant