ConvertTo8Bpp216 Method (GdPictureImaging)
In This Topic
Converts a GdPicture image to an 8-bit indexed color image using a standard color palette.
This method uses an automatic segmentation components algorithm.
The color table has a maximum of 256 entries but only 216 will be used.
Syntax
Parameters
- ImageID
- GdPicture image identifier.
Return Value
A member of the GdPictureStatus enumeration.
Example
Converting a bmp to a png and setting white as transparent color.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp", false);
// Convert to an 8-bit indexed color image using a standard color palette, set white as transparent and save to png.
gdpictureImaging.ConvertTo8Bpp216(imageID);
gdpictureImaging.PaletteSetTransparentColor(imageID, Color.White);
gdpictureImaging.SaveAsPNG(imageID, "image.png", 6, false);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Converting a bmp to a png and setting white as transparent color.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp", false);
// Convert to an 8-bit indexed color image using a standard color palette, set white as transparent and save to png.
gdpictureImaging.ConvertTo8Bpp216(imageID);
gdpictureImaging.PaletteSetTransparentColor(imageID, Color.White);
gdpictureImaging.SaveAsPNG(imageID, "image.png", 6, false);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also