Just looking at the man page, http://doc.qt.io/qt-4.8/qimage.html, I'm going to 
take a guess.

Let's suppose for the moment that you are dealing specifically with a 3 channel 
(RGB) image. I think you want something like this:

    ImageBuf B ("myfile.exr");
    // Force the ImageBuf to read the file now, and bypass the ImageCache
    B.read (0 /*subimage*/, 0 /*miplevel*/, true /*force full read now*/,
            TypeDesc::UINT8 /*force conversion to UINT8*/);

    // Do whatever manipulation (color conversion, etc.) you want on B. But
    // if you copy it to another image, be sure that the final destination
    // is initialized to be UINT8.

    // Now create a QImage that copies the pixels from B.
    QImage Q ((const unsigned char *)B.localdata(),
              B.spec().width, B.spec().height,
              QImage::Format_RGB888);

If it's a 4-channel image, it's slightly tricker because for some reason Qt 
wants ARGB rather than RGBA. So you'd probably need to use 
ImageBufAlgo::channels() to reshuffle the channel order first, and pass 
QImage::Format_ARGB32_Premultiplied as the format descriptor.

Please let us know if that worked. If this is helpful, I'll add it to the docs 
somewhere.


> On Feb 2, 2016, at 10:15 PM, Renaud <[email protected]> wrote:
> 
> Hi !
> 
> I've been trying to load an image using the ImgBuff approach for a while now
> but I can't quite figure out how to dump the ImgBuff back into a QImage.
> 
> Would anyone be kind enough to provide a simple example on how to do that ?
> 
> I was able to load images into a QImage using the following method :
> http://permalink.gmane.org/gmane.comp.lib.openimageio.devel/140
> 
> but I would like to be able to process the image using OCIO: LUT, colorpsace
> changes, ... before dumping the result into a QImage.
> 
> Any help would be greatly appreciated.
> Thanks.
> 

--
Larry Gritz
[email protected]


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

Reply via email to