letmaik / rawpy

📷 RAW image processing for Python, a wrapper for libraw
https://pypi.python.org/pypi/rawpy
MIT License
613 stars 68 forks source link

Allow to set LibRaw dataerror_handler. #76

Closed ccl closed 5 years ago

ccl commented 5 years ago

I ran into the situation where I needed to read a bunch of raw images for analysis in Python. With the help of RawPy, that is usually a piece of cake. It turned out that a couple of the files could not be read, resulting in LibRaw reporting a data corruption to stderr. However, that is the only way that the error is detectable. There are no exceptions, no error codes as return values, and the raw_image is still accessible, albeit corrupted.

LibRaw allows to set a callback function for handling such errors, and this pull request exposes corresponding methods to Python.

letmaik commented 5 years ago

Thanks! Looks quite useful. To understand better how to use it, can you add a test that triggers an error which then is checked?

ccl commented 5 years ago

Yes, I can do that. And I should add proper docstrings once I am at it.

letmaik commented 5 years ago

Are you still working on this?