Hi !

I was able to get my get my image loaded and converted to a QImage using code 
that Larry and Peter Black helped with a little while back, that said for some 
reason when I try to scale down my image (to generate a thumbnail) both 
ImageBufAlgo::resize and ImageBufAlgo::resample crop the original image (using 
a portion of the source image from what seems to be a roi of 0, 480, 0, 270) 
instead of using the full ROI from the source and scaling it down into a 
smaller thumbnail ImgBuf.
I am pulling my hair off on this. I have used both resize and resample with 
pyOpenImageIO with no issue, it’s pretty much the same code here so I’m not 
sure what I am doing wrong.
As usual, any help would be greatly appreciated. (I’m using OIIO 1.7 on Windows 
10, compiled with VS2015)

Thanks,

Renaud

Code:

ImageBuf srcImageBuf("C:/someImage.dpx”);

int thumbWidth = 480;
int thumbHeight = 270;
int thumbChans = 3;

ImageSpec thumbSpecSpec( thumbWidth, thumbHeight, thumbChans, TypeDesc::UINT8 );
ImageBuf resizedBuf( thumbSpecSpec );
ImageBufAlgo::resample ( resizedBuf, srcImageBuf );

unsigned char* myBuffer = (unsigned 
char*)malloc(thumbSpecSpec.width*thumbSpecSpec.height*thumbSpecSpec.nchannels );
srcImageBuf.get_pixels(resizedBuf.roi_full(), TypeDesc::UINT8, myBuffer);

// Create QImage
QImage::Format QIFormat = QImage::Format_RGB888;
QImage *newQImage = new QImage(myBuffer, resizedBuf.spec().width, 
resizedBuf.spec().height, QIFormat);
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to