[Qt-interest] how to build a grayscale QImage

Samuel Rødal samuel.rodal at nokia.com
Thu Feb 18 14:36:15 CET 2010


ext hakiim the dream wrote:
> Hi all, 
> i have a 8-bit grayscale image, say a 2-D matrix of intensity values 
> represented by a unsigned char pointer. My aim is to form a QImage with 
> this data.
> How can i do this? In the documentation, it is told that QImage supports 
> mono(0-1) and 8-bit indexed images by a color table.

Create a grayscale color table, and use one of the QImage constructors 
where you pass in your own data pointer.

--
Samuel



More information about the Qt-interest-old mailing list