Software Archive
Read-only legacy content
17061 Discussions

Could anyone tell me about format conversion of PXCImage

krishna_m_1
Beginner
486 Views

hi,

How to convert the   PXCImage in PIXEL_FORMAT_RGB32  to PXCImage in PIXEL_FORMAT_RGB24 ??

0 Kudos
1 Reply
jb455
Valued Contributor II
486 Views

I haven't tried this myself but from looking at the docs, you may have some luck using the CopyImage method. So if you have a 32 bit image (oldImage), you could try creating a new 24 bit image and copying the former to the latter. Something like:

 

PXCMImage.ImageInfo iinfo=new PXCMImage.ImageInfo() {
    width=oldImage.Width, height=oldImage.Height, format=PXCMImage.ColorFormat.COLOR_FORMAT_RGB24
};

PXCMImage newImage=session.CreateImage(iinfo);
if(newImage.Copy(oldImage) != PXCMStatus.
STATUS_PARAM_UNSUPPORTED)
   //
The function returned successfully.
else
   //
Failed to copy image due to unsupported pixel format conversion.

Again, no idea if this will work, but worth a try maybe? 

0 Kudos
Reply