ImageGear for C and C++ on Linux v18.8 - Updated
Color Promotion
User Guide > How to Work with... > Image Processing and Cleanup > Color Promotion

Color promotion is the process of increasing the bit depth, or number of bits per pixel, of an image. The color of each pixel is retained. ImageGear provides one function that handles promotion to any bit depth. It is called as follows:

 
Copy Code
      IG_IP_color_promote ( hIGear, IG_PROMOTE_TO_24 );

The constant shown in the example above may instead be IG_PROMOTE_TO_4 or IG_PROMOTE_TO_8. Your image must originally have fewer bits per pixel than the bit depth to which you are promoting it.

When promoting to 4 or 8 bits, the promotion is accomplished by simply increasing the number of bits per pixel for each pixel (but without changing the pixel's value), and increasing the size of the DIB palette (the added palette entries are each set to zero).

When promoting to 24 bits, the 24-bit color of the pixel (obtained from the image's original palette) becomes the 24-bit pixel in the resulting promoted image. The DIB palette is deleted, since a 24-bit image does not have a DIB palette.

The function IG_IP_convert_to_gray(), though it could increase the number of bits per pixel in an image, is considered a color reduction function, because it reduces the colors to shades of gray.