Image 32 bit depth to 8 bit depth
Hi,
I'm taking an image from scanner using TWAIN and I use the "QPixmap::fromWinHBITMAP(HBITMAP)" method to convert the scanned image to a QPixmap. The HBITMAP info tells me that the image is 8 bit depth but when converting to QPixmap it returns me 32 bit depth.
Any one knows how to convert this QPixmap 32 bit depth to 8 bit depth? The image is scanned on 8 bit depth gray.
Thanks,
Re: Image 32 bit depth to 8 bit depth
Convert it to image using QPixmap::toImage() and then use QImage::convertToFormat() to convert it to QImage::Format_Indexed8. Then you might need to adjust the palette.
Re: Image 32 bit depth to 8 bit depth
Thanks,
I have used another way. I created the image with Width and Height and Indexed palette, then I just copied the image buffer to the QImage buffer. Now I only just have to invert the copy process because the Bitmaps are stored inverted by line.
Thanks,