• 13
• 18
• 19
• 27
• 10

# Displaying 16 bit raw images

This topic is 3211 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

If I have an array of data (16 bit values) that represent pixel intensity (in other words a grayscale image), can anyone tell me how to display this data in a picture box in an MFC application? If the code is long or complicated I guess don't worry about it, but it seems like a simple thing that I've just spent way too much time digging around trying to solve. Thanks, Andrew

##### Share on other sites
I'm not much in the MFC, but AFAIK you have a Paint event for the picture box.
In it, you can do a blit to the HWND with the data, but I guess you'll need some data transforming before.

I would create a bitmap in memory. I'm not sure if there's an standard 16 bits greyscale bmp, but you can always do:

unsigned char R,G,B;for (i = 0; i < ArraySize; i++){    int Luminance = Array * 256 / 65535;    R = G = B = Luminance;    ...}

And fill up a BitmapInfo structure with these values.
http://msdn.microsoft.com/en-us/library/aa921550.aspx