How to convert 24 bit bmp RGB888 to 16 bit bmp RGB565 ?
-
Hi All,
As the title says.. I like to convert a 24bit bmp to 16bit bmp...
When i use the following code@
QImage myImage(2x2_24.bmp);
QImage *myImageNew = new QImage(myImage.convertToFormat(QImage::Format_RGB16,Qt::AutoColor));
myImageNew->save("2x2_qt_16.bmp);
@The image is still a 24bit bmp !!!!
Any ideas ?I'm using qt4.8 and mingw
Thanks
-
Hi zanes,
IMO, you have successfully converted it from RGB24 to RGB16.
Perhaps the member function
@
uchar * QImage::bits ()
@
can be used to verify the case.The problem is that, when you try to save it using .bmp format, it will be converted to RGB32.
@
bool QBmpHandler::write(const QImage &img)
{
QImage image;
switch (img.format()) {
case QImage::Format_ARGB8565_Premultiplied:
case QImage::Format_ARGB8555_Premultiplied:
case QImage::Format_ARGB6666_Premultiplied:
case QImage::Format_ARGB4444_Premultiplied:
image = img.convertToFormat(QImage::Format_ARGB32);
break;
case QImage::Format_RGB16:
case QImage::Format_RGB888:
case QImage::Format_RGB666:
case QImage::Format_RGB555:
case QImage::Format_RGB444:
image = img.convertToFormat(QImage::Format_RGB32);
break;
default:
image = img;
}
...
@Regards,
Debao