Colin,
quite simple:
for (int i=0; i < spec.nchannels ; i++){
file->read_scanlines(spec.width, spec.height, 0, i, 1, spec.format, out_data);
    //...do whatever you want with out_data
}

'i' tells you need the i-th channel, the 1 after that you want to read only one channel.

This snippet reads entire channels one after the other.

On 05/30/2013 10:48 PM, Larry Gritz wrote:
You can't request the channels be returned and not interleaved.

But there are varieties of read_scanlines and read_tiles that let you select a channel range 
(including just one channel), so you could do it with one call per channel.  Look in imageio.h for 
the calls with "chbegin" and "chend" in the argument lists.



On May 29, 2013, at 5:13 PM, Colin Doncaster wrote:

Hi there -

What is the default buffer layout when using read_image(TypeDesc::FLOAT, data)? 
 It appears to be interleaved channels ( rgbargba... ), if that's the case is 
it possible to request the data to NOT be interleaved ( rrrrggggbbbb... )?  It 
appears that we can define stride lengths but for dimensions of the whole 
image, not the channels themselves.

Thank you!
--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to