>     // 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);
> 

Hi Larry !
I apologize for the delayed answer, I didn't get any notification from the
mailing list so I assumed nobody answered my message. Thank you very much
again for the help. I think an example which goes all the way to a QImage
would be great in the doc.
When I read the documentation I had a hard time figuring out where the image
"raw data" was "stored" when using an ImageBuf reading method.
"localdata()" from your example seems to be what I was missing but
unfortunately it doesn't seem to exist.

I replaced "B.localdata()" with "B.localpixels()", the code compiles but the
program crashes when I try to display the resulted QImage (most likely
"corrupted" data). Maybe using localpixels() is the issue ?

I also tried Pete's methods with no luck.


Code:

ImageBuf myImageBuf (filename);

myImageBuf.read (0 /*subimage*/, 0 , true , TypeDesc::UINT8);

QImage *newQImage = new QImage((const unsigned char
*)myImageBuf.localpixels(), myImageBuf.spec().width,
myImageBuf.spec().height, QImage::Format_RGB888);

return newQImage;


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

Reply via email to