Hey
I am begginer in QT and I would like to transform bitmap file to byte array (RGB332 format).
Any ideas how to do this?
Regards
Hey
I am begginer in QT and I would like to transform bitmap file to byte array (RGB332 format).
Any ideas how to do this?
Regards
As far as I know Qt doesn't support RGB332 natively so you'd need to do the transformation yourself and then store values into QByteArray using its API.
Otherside (15th January 2012)
Thx for the reply.
At the moment I have problem with getting RGB values.
Qt Code:
... ... for (int j = 0; j < 640; j++ ){ buffer[j] = (tempColor.red() & 0xE0>> 16) | (tempColor.green() & 0xE0 >> 8) | tempColor.blue() & (0xC0 >> 6); }To copy to clipboard, switch view to plain text mode
This should read and store to buffer one row of image. Image is opened correctly but data in buffer is not correct. For example for one color bitmap it gives almost random values (smth like 8 pixels blue then 12 black then 11 yellow etc). Diffrent images gives different results. I also tried different formats with no effect.
What am I doing wrong?
Last edited by Otherside; 15th January 2012 at 02:39.
There is error in above code, should be:
but it dosen't change much.Qt Code:
buffer[j] = (tempColor.red() & 0xE0) | (tempColor.green() & 0xE0 >> 3) | tempColor.blue() & (0xC0 >> 6);To copy to clipboard, switch view to plain text mode
Why I can't edit my posts after some time?
Otherside (15th January 2012)
buffer has type unsigned char* so I think I am writing 8 bits to 8 bits?
Anyway, here is result displayed on crt monitor and oryginal file(had to convert it to jpeg to upload here):
IMG20120115_005.jpg
test12345b.JPG
Any clues?
Solved. Problem was somewhere else...
Bookmarks