I am trying to load an image that is given to me as a BITMAPINFO* and a uchar array.
The documentation states that it is a standard Microsoft device independent bitmap (DIB) with 8-bit pixels and a 256-entry color table.
I am curently able to open this image through:
BITMAPINFO* bmih = givenBITMAPINFO;
uchar* data = givenData;
QImage img = QImage(data, bmih->biWidth, bmih->biHeight, QImage::Format_Grayscale8);
But I have two problems with that:
the image is in
QImage::Format_Grayscale8when the documentation states an 8-bit pixels and a 256-entry color table;the image is upside down and mirrored. This come from the way the bitmap data is stored in Win32.
Anyone knows how I can load properly this image?
By casting the provided header to a
BITMAPINFOinstead of aBITMAPINFOHEADERI have access to the color table and then apply a trasformation to get a streight image: