This method converts images from one bit count to another.
Public Function ConvertColor(pixelType As Integer, fixPalette As Boolean, dithering As Boolean, level As Integer) As Boolean
public bool ConvertColor(int PixelType, bool FixedPal, bool dithering, int level);
Parameters
pixelType
The number of bits per pixel (1, 4,
8, 16, 24, 32, 40, 80) after the conversion
* 4 represents 4 bit color, 40 is
for 4 bit grayscale, 8 is for 8 bit color, and 80 is for 8 bit
grayscale
fixPalette
Fixed palette settings (Use when
decreasing or increasing to 1, 4, or 8 bit color)
false: Uses a created palette most
suitable for the image
true: Uses a fixed palette
dithering
Sets the dither (error diffusion)
(Use when decreasing to 1, 4, or 8 bit color or 4 bit
grayscale)
false: Does not dither
true: Dithers
level
Threshold value settings (Use when
decreasing to 1 bit images)
0 to 255
Return Value
Returns True if successful. Returns False if unsuccessful.
Explanation
The ConvertColor method changes the number of colors (also known as the bit count) of a raster image.
To execute the ConvertColor method, set the image handle of the image in the SourceImage property. This method supports 1, 4, 8, 16, 24, and 32 bit images. When decreasing the number of colors of an image to 1 bit color, if the RGB value (an average of the red, green, and blue values) is less than the threshold value, the palette is set to 0, otherwise it is set to 1.
If successful the resulting raster image data is set in the DestinationImage property.