Skip to content

Expose structs: libraw_imgother_t and libraw_lensinfo_t#289

Merged
letmaik merged 7 commits into
letmaik:mainfrom
pam-param-pam:main
May 3, 2026
Merged

Expose structs: libraw_imgother_t and libraw_lensinfo_t#289
letmaik merged 7 commits into
letmaik:mainfrom
pam-param-pam:main

Conversation

@pam-param-pam
Copy link
Copy Markdown
Contributor

Per what i said in #287
I exposed imgother_t and lensinfo_t structs.

Its my first real PR to an open source project. And I have no expierience with c++ pyhon wrappers so i apologize if I did something wrong.

Im unsure whetever i should add tests for this.
And im unsure if i should update the docs/add examples.

Im looking forward to hear what i should change/update

Copy link
Copy Markdown
Owner

@letmaik letmaik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, I think this is quite useful, especially if other libraries don't cover it. It definitely needs some tests, and I would change it to typed named tuples. Bonus points if you can extend the sphinx API docs as well.

Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
Comment thread rawpy/_rawpy.pyx Outdated
@pam-param-pam
Copy link
Copy Markdown
Contributor Author

pam-param-pam commented Apr 12, 2026

I renamed fields.
Changed from dicts -> NamedTuples.
Removed unneeded fields
Extended docs
Extended basic_proccess example

I also added 2 tests. But im unsure if they are correct. I don't really see the point of veryfing each field since its either fully correct or not. And even if there was a bug it would be due to libraw and not due to the rawpy

shutter_speed is not really human readable. Its 0.05000000074505806 instead of 1/250. Unsure if u want the wrapper to convert it.

I would also like to expose gpsdata from other_t but it would need to be converted into something like this:

class GPS(NamedTuple):
    latitude: float
    longitude: float
    altitude: float | None
    altitude_ref: int
    timestamp: str | None

And idk if u want the the wrapper to handle the conversion(and if yes, in .pyx or in .pyi)

@pam-param-pam
Copy link
Copy Markdown
Contributor Author

Any news?

@letmaik
Copy link
Copy Markdown
Owner

letmaik commented May 3, 2026

Re shutter_speed, if you're not sure or don't use it yourself, then I would leave it out.

For gps data, your proposed named tuple makes sense. The conversion needs to happen in the .pyx. timestamp should be a datetime though, and not sure what altitude_ref is exactly. Also, I saw there's libraw_gps_info_t parsed_gps, would that be what you're using instead of unsigned gpsdata[32];?

@pam-param-pam
Copy link
Copy Markdown
Contributor Author

I will be using shutter_speed and i would need it in a human readable format. But i can format it inside my own application. So lets leave it as is

You are right. There's indeed libraw_gps_info_t struct. I somehow glanced over it.
I don't really need it hovewer right now. And im not sure how to parse it properly either. Not to mention i can't find a single image that would have the gps data in the first place. So we can leave it as is for now.

I am happy to merge if you are

@letmaik letmaik merged commit 326494b into letmaik:main May 3, 2026
29 checks passed
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.

3 participants