Display image from raw bitmap file to bmp file

1.5k Views Asked by At

I am trying to create a QT application which will display a image (bmp) from a raw bitmap file. The raw bitmap file is of .panel file format. Its in RGB565 format.

How do we use/convert the raw bitmap (img.panel) into a bmp file, so I can use it Qimage.

QFile file("/usr/bitmap.bmp");
if (!file.open(QFile::ReadOnly)) 
return 0;

QByteArray array = file.readAll();
QImage image((const uchar*)array.data(), h_bitmap, v_bitmap, QImage::Format_RGB16);
image.save("/usr/test_qimg_16.bmp","BMP");
image = image.convertToFormat(QImage::Format_RGB16);
image.load("/usr/test_qimg_16.bmp");
QPixmap pixmap;

This is the image I get after this operation. http://tinypic.com/r/kb4pd4/8

But I am expecting something like this : http://tinypic.com/r/dptpq1/8

Thank you. Any help is appreciated.

0

There are 0 best solutions below