OpenImageIO
                                
                                
                                
                                    OpenImageIO copied to clipboard
                            
                            
                            
                        API to read ImageInput into ImageBuf
In the comments of #4225, @zavinator suggested:
it would be great if the ImageInput class could integrate more seamlessly with ImageBuf, for instance by returning an ImageBuf instance for each subimage along with its associated metadata.
This is a great idea, and I can think of several possible forms for this to take:
- An ImageBuf constructor that takes an open ImageInput* where it reads from the "current" subimage of the input into the IB. (IB already has a write() method that writes to an open ImageOutput that you pass it.)
 - An ImageInput::read_imagebuf() method a bit like read_image(), but returns (or reads into?) an ImageBuf rather than reading into a memory buffer.
 - One of the above two, but as a fully standalone utility functions rather than being a method of either ImageBuf or ImageInput.
 - Some kind of iterator that, given an ImageInput* and ImageBuf*, reads each successive subimage from the ImageInput into the IB. (Choice 1: it's just the iterator and you call next() to advance; choice 2: it's a total black box and the caller doesn't iterate, but rather, what you supply is a lambda that is called for each subimage?)
 
Or something else I haven't thought of?
Please feel free to continue the discussion in the comments to this issue.