16bit rgb image

Hi,

Does any one know the 16 bit rgb file’s structure? 24 bit image, 8 for r 8 for g and 8 for b.

I use windows 2000, i wonder to know if 16 bit use fixed palette? How to conver 24 bit image to 16 bit image?

Thanks!

I believe you just have to allocate the available bits to r,g and b.A common 16bit format for instance is R5G6B5 or 565.

For a simple life OpenGL allows you to supply the image data as RGB888 for example and it will automatically perform the conversion from your memory representation to the internal format representation. This is why in calls like glTexImage2D there is a distinction between the internal format argument, which supports packed 16 bit formats like GL_RGB5_A1 and the format and type arguments which describe your in memory representation.

For optimal performance you can use special external format tokens which match the internal format of the texture you require, but you wouldn’t want to swizzle these on the fly. Use OpenGL for this unless you intend to store a persistent packed represenation.

To send packed data (where the MSB of each byte are packed together) you use the packed pixel format tokens defined as the data type leaving the pixel format format as RGBA or ABGR.