OpenImageIO/oiio — pull request #667 by lgritz (2013-09-06 06:19:30+00:00)
Title: Python overhaul: ImageInput (fixes, expose new methods, unit tests, docs)

Part 2 of the Great Python Overhaul of 2013.

This time it's ImageInput (and a few stray changes to TypeDesc and ImageSpec internals).

It is crucial to note that we have changed the modus operandi of open(), seek_subimage(), and the read_*() functions in two ways: (1) we never write to an ImageSpec by reference, instead it is expected that the caller ask for the spec explicitly via input.spec(); (2) we never write to an application buffer passed by reference, and instead the read() functions allocate their own array and pass it back as the return value. This is more Pythonic, and mimics the way File.read() works (C++ read/fread write into caller's buffer, Python File.read() returns an allocated buffer).

This will necessarily break compatibility with existing Python scripts using the old interface. Sorry. But I think the new way really is better and this overhaul is desperately needed. Also, since we never formally documented the Python bindings in the OIIO documentation (but now we do!), I don't feel a strong commitment to preserving the old way that we never really guaranteed would work any particular way.