Conversion functions

Bitmaps in FreeImage are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the library provides several conversion functions.

Subsections

FreeImage_ConvertTo8Bits

FIBITMAP *FreeImage_ConvertTo8Bits(FIBITMAP *dib);

Converts the given bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale.

FreeImage_ConvertTo16Bits 555

FIBITMAP *FreeImage_ConvertTo16Bits555(FIBITMAP *dib);

Converts the given bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits red and 1 unused bit.

FreeImage_ConvertTo16Bits565

FIBITMAP *FreeImage_ConvertTo16Bits565(FIBITMAP *dib);

Converts the given bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits red.

FreeImage_ConvertTo24Bits

FIBITMAP *FreeImage_ConvertTo24Bits(FIBITMAP *dib);

Converts the given bitmap to 24 bits.

FreeImage_ConvertTo32Bits

FIBITMAP *FreeImage_ConvertTo32Bits(FIBITMAP *dib);

Converts the given bitmap to 32 bits.

FreeImage_ColorQuantize

FIBITMAP *FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);

Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap. The quantize parameter specifies which colour reduction algorithm should be used.

Parameter Description
FIQ_WUQUANT Wu's color quantization algorithm
FIQ_NNQUANT NeuQuant quantization algorithm