ImageGear for C and C++ on Linux v18.8 - Updated
IG_IP_color_reduce_bayer
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_color_reduce_bayer

This function reduces the image to a fewer number of Bits Per Pixel, using a Bayer dithering algorithm.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_color_reduce_bayer ( 
        HIGEAR hIGear, 
        UINT nToBits, 
        LPAT_RGBQUAD lpPalette 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image of which to reduce bit depth.
nToBits UINT Number of bits per pixel after reduction (4 or 1).
lpPalette LPAT_RGBQUAD This argument is currently not used.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Indexed RGB – 4, 8 bpp;
Grayscale – 4, 8 bpp;
RGB – 24 bpp.

Example:

 
Copy Code
HIGEAR hIGear;     /* HIGEAR handle of 4, 8, or 24 bit image */
/* Reduce image to 1-bit black-and-white: */
IG_IP_color_reduce_bayer ( hIGear, 1, NULL );

Remarks:

The target bit depth is specified by argument nToBits. In general, a color image will be reduced to a fewer number of colors, and a grayscale image will be reduced to a fewer number of shades of gray. Note that setting nToBits = 1 will reduce the image to monochrome or black-and-white.

The input number of Bits Per Pixel must be greater than nToBits, or an error will result.

See also the section in entitled Color Reduction.