This function reduces the image to a fewer number of Bits Per Pixel.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_color_reduce_diffuse ( HIGEAR hIGear, UINT nToBits, INT level, LPAT_RGBQUAD lpPalette ); |
Arguments:
hIGear | HIGEAR handle of image of which to reduce bit depth. |
nToBits | Number of bits per pixel after reduction, 1 or 4. |
nLevel | Threshold value for dithering, 0 to 255. |
lpPalette | 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.
Sample:
None
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_diffuse ( hIGear, 1, 128, 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.
nLevel sets a threshold value for the target image. nLevel = 128 means that black and white in the target image will be in equal proportion. nLevel greater than 128 would mean more bright than dark, nLevel less than 128 would mean more dark than bright.
The input number of Bits Per Pixel must be greater than nToBits, or an error will result.
See also section in entitled Color Reduction. |