PDA

View Full Version : How to display 16 bit grayscale pictures?



reimer
20th August 2008, 11:34
How can I display 16 bit grayscale pictures?

aamer4yu
20th August 2008, 11:52
Have u tried QPixmap ?

reimer
20th August 2008, 12:14
I've used QImage because I want to modify the pixels.

wysota
20th August 2008, 12:45
So convert the image to QPixmap and display it.

reimer
20th August 2008, 13:32
To point it out I don't have a problem to display pictures but I don't know what Format (http://doc.trolltech.com/4.4/qimage.html#Format-enum) I should use.

With qRGB(value, value, value) do I only get a 8 bit grayscale, don't I?

Raistlin
20th August 2008, 19:55
You can only display 8-bit gray values on a standard computer screen, so you need to convert your data to 8 bit first. You can use adaptable min and max values to rescale. This way you can keep the original 16 bit in memory and let the user choose the scaling limits interactively.

I use QImage::Format_Indexed8 with a color map where the R,G,B components are always equal to eachother.