bibhukalyana
23rd September 2011, 09:33
Hi everyone,
I have a raw data of an image(width = 127,height = 64,16 bit per pixel).I want to save and convert it into a 24 bit BMP image.For saving I am using the following code.
QImage img(rawData,width,height,width * 2,QImage::Format_RGB16);
img.save("test_qimg_16.bmp","BMP");
But the saved file was a 24bit BMP image.
For converting i am using the following code.
memcpy(buf,rawData + j,2);
extract_ushort_from_buffer(buf,0,0,&num);
unsigned char red = (num & 0xf800) >> 11;
unsigned char green = (num & 0x07c0) >> 5;
unsigned char blue = num & 0x003f;
The saved image is a 24bit BMP.
But the first one is better than 2nd.
Can any one told me when i am trying to save in 16 bit why it saved in 24 bit and how i will convert the 16bit raw data to 24 bit raw data.
thanks.
I have a raw data of an image(width = 127,height = 64,16 bit per pixel).I want to save and convert it into a 24 bit BMP image.For saving I am using the following code.
QImage img(rawData,width,height,width * 2,QImage::Format_RGB16);
img.save("test_qimg_16.bmp","BMP");
But the saved file was a 24bit BMP image.
For converting i am using the following code.
memcpy(buf,rawData + j,2);
extract_ushort_from_buffer(buf,0,0,&num);
unsigned char red = (num & 0xf800) >> 11;
unsigned char green = (num & 0x07c0) >> 5;
unsigned char blue = num & 0x003f;
The saved image is a 24bit BMP.
But the first one is better than 2nd.
Can any one told me when i am trying to save in 16 bit why it saved in 24 bit and how i will convert the 16bit raw data to 24 bit raw data.
thanks.