Re: Apply color transformation on images containing a single channel

Mark Boorer <mark...@...>

Hi Jeremy,

Thanks for your quick reply!

Unfortunately, it seems that PlanarImageDesc also requires at least 3 channels of data. I tried passing it NULL pointers for the other, non existing channels, though it complains at runtime that "Valid ptrs must be passed for all 3 image rgb color channels".

I guess I can construct dummy 0 arrays for the other channels, but that seems like a waste of resources. Do you have any other ideas?


On Thursday, April 11, 2013 1:59:55 PM UTC+10, Jeremy Selan wrote:
If your image is packed separately per channel (ex:  RRRRRRR... GGGGG... BBBB.... ), the Planar ImageDesc is probably what you're looking for. Give that a try?

PlanarImageDesc(float * rData, float * gData, float * bData, float * aData,
                        long width, long height,
                        ptrdiff_t yStrideBytes = AutoStride);

Note that the float * for alpha is optional, so if you are only loading RGB you can pass a NULL ptr for that.

-- Jeremy

On Wed, Apr 10, 2013 at 8:36 PM, Mark Boorer <mar...@...> wrote:

In my application, images are split into their separate channels, and operations are performed per channel. I have individual float arrays for each channel (obtained via openimageio), and I would like to perform a colorspace transformation to each, preferably without joining them together.
I noticed that the PackedImageDesc docs say it ignores channels > 4, is there an easy way in the c++ library to provide a float array, and specify which channel it contains to perform the transformation?

Something like:

OCIO::PackedImageDesc img(data, w, h, 1, "R");


You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Join { to automatically receive all group messages.