| FreeImage Documentation - Contents Previous Next Up |
Conversion functions
Bitmaps in FreeImage are always loaded in their default bitdepth. If you want the bitmap to be stored in another bitdepth, the library provides several functions to do the conversion.
SubsectionsFreeImage_ConvertToGreyscale
void FreeImage_ConvertToGreyscale(void *dib);
Grays out the given bitmap. FreeImage_ConvertTo8Bits
void *FreeImage_ConvertTo8Bits(void *dib, bool type555 = false);
Converts the given bitmap to 8 bits. If the bitmap is 24 or 32 bit RGB, the color values are converted to grayscale. If the bitmap is 16-bit, the second parameter specifies how the bitmap is treated. If type555 is true, a colour representation of 5-5-5 (5 bits for red, 5 bits for green, 5 bits for blue) is assumed. Otherwise a 5-6-5 (5 bits for red, 6 bits for green, 5 bits for blue) is used. FreeImage_ConvertTo16Bits
void *FreeImage_ConvertTo16Bits(void *dib, bool type555 = false);
Converts the given bitmap to 16 bits. If type555 is true, the bits are ordened in a 5-5-5 style manager, otherwise 5-6-5 is used. FreeImage_ConvertTo24Bits
void *FreeImage_ConvertTo24Bits(void *dib, bool type555 = false);
Converts the given bitmap to 24 bits. If the bitmap is 16-bit, the second parameter specifies how the bitmap is treated. If type555 is true, a colour representation of 5-5-5 (5 bits for red, 5 bits for green, 5 bits for blue) is assumed. Otherwise a 5-6-5 (5 bits for red, 6 bits for green, 5 bits for blue) is used. FreeImage_ConvertTo32Bits
void *FreeImage_ConvertTo32Bits(void *dib, bool type555 = false);
Converts the given bitmap to 32 bits. If the bitmap is 16-bit, the second parameter specifies how the bitmap is treated. If type555 is true, a colour representation of 5-5-5 (5 bits for red, 5 bits for green, 5 bits for blue) is assumed. Otherwise a 5-6-5 (5 bits for red, 6 bits for green, 5 bits for blue) is used. FreeImage_ColorQuantize
void *FreeImage_ColorQuantize(void *dib);
Quantizes a 24-bit bitmap to an 8-bit bitmap using Wu's octree algorithm. Copyright 2000 Floris van den Berg (freeimage@wxs.nl) |