In C++, you can just call read_scanlines and pass format=UNKNOWN to get back the raw data in its original format.
The problem is that in Python, there is no 'half' so it's not quite sure what to return. I kinda like the decoupling of the raw reads (read_native_*) which are the part overloaded by the individual format readers, from the app-callable read_*. So perhaps rather than exposing read_native_*, we should just modify the Python bindings for read_* to notice that if the native raw data is not a type representable in Python, to return it as an unsigned character array? > On Feb 17, 2016, at 2:55 PM, Andrew Gartner <[email protected]> wrote: > > Hey all, > > Apologies if this has come up before, but I'm curious if anyone had > considered exposing ImageInput.read_native_scanlines() on the python side > before. The reason I ask is mainly because the half datatype doesn't exist in > the native python array class which OIIO uses for python reads. Currently the > python array will punt and for anything to float (which I'd rather avoid). > > I had put together an implementation in OIIO 1.5 that simply took the pixel > size as a parameter and exposed read_native_scanlines that way and that > allowed me to get the right data properly into either numpy or a raw char > python array. However, I'd rather not be forked off like that as it's a > headache trying to remain current with the mainline, plus others may find it > useful. > > Does anyone think exposing the function in general makes sense? I'm happy to > send the implementation if anyone cares to see it as well. > > Cheers, > > ~Andrew > -- Larry Gritz [email protected] _______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
