PDA

View Full Version : how to convert a bitmap to bit array?



Wojtek_SZ
3rd September 2012, 18:55
Hello,

I have problem with converting bitmap - QImage to bit array.
I just dont't know which function I have to use.
Can someone suggest me something?
Thanks
Wojtek

d_stranz
3rd September 2012, 19:04
Did you read the QImage documentation? Looks like QImage::bits() is exactly what you need.

Wojtek_SZ
3rd September 2012, 19:10
Thanks for reply.
Yes I did...
According to the documentation this function returns a pointer to the first pixel data, but I need to store all information about every pixel RGB colors in separate cell.

d_stranz
3rd September 2012, 19:51
Well, then it seems like a nested pair of loops based on QImage::height(), QImage::width(), and QImage::pixel() would do it, don't you think?

Wojtek_SZ
3rd September 2012, 21:03
Thank you.