This function reduces the image to a fewer number of Bits Per Pixel.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_color_reduce_diffuse ( HIGEAR hIGear, UINT nToBits, INT level, LPAT_RGBQUAD lpPalette ); |
Name | Type | Description |
---|---|---|
hIGear | HIGEAR | HIGEAR handle of image of which to reduce bit depth. |
nToBits | UINT | Number of bits per pixel after reduction, 1 or 4. |
Level | INT | Threshold value for dithering, 0 to 255. Has effect only if nToBits = 1. |
lpPalette | LPAT_RGBQUAD | This argument is currently not used. |
Returns the number of ImageGear errors that occurred during this function call.
Indexed RGB – 4, 8 bpp;
Grayscale – 4, 8 bpp;
RGB – 24 bpp.
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_diffuse ( hIGear, 1, 128, NULL ); |
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.
When reducing the image to monochrome (black-and-white), the level parameter sets a threshold value for the target image:
The input number of Bits Per Pixel must be greater than nToBits, or an error will result.