View Full Version : How do i display the rgb value of a pixel

17th May 2009, 23:03
Could anyone tell me how to display the rgb pixel values of a qimage that has the format of QImage::Format_RGB32. So far i tried this

QImage* image = new QImage("/images/testimg.jpg");

cout << image->format(); // gives the value 4

for(int y=0; y < image->height(); y++)
QRgb val = image->pixel(0, y);
cout << " rgb value = " << val << endl;

After i get the proper values i will iterate over and x and y but with this im only seeing values like this

rgb value = 4294043701 and when using an image app like gimp and looking at the first pixel value things dont match up. Should these be rgb values between 0-255, what am i missing here? Thanks

18th May 2009, 00:36
Try to use

18th May 2009, 00:51
Thank you very much that was what i needed!