GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / PaletteSetTransparentColor Method
GdPicture image identifier.
Color to set as transparent. A suitable color value can be obtained by using the ARGB() method.
Example





In This Topic
PaletteSetTransparentColor Method (GdPictureImaging)
In This Topic
Sets a color of a palette as transparent. If the specified color is not present into the palette this will be added if the number of entries is lower than 256.
Syntax
'Declaration
 
Public Function PaletteSetTransparentColor( _
   ByVal ImageID As Integer, _
   ByVal TransparentColor As GdPictureColor _
) As GdPictureStatus
public GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   GdPictureColor TransparentColor
)
public function PaletteSetTransparentColor( 
    ImageID: Integer;
    TransparentColor: GdPictureColor
): GdPictureStatus; 
public function PaletteSetTransparentColor( 
   ImageID : int,
   TransparentColor : GdPictureColor
) : GdPictureStatus;
public: GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   GdPictureColor TransparentColor
) 
public:
GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   GdPictureColor TransparentColor
) 

Parameters

ImageID
GdPicture image identifier.
TransparentColor
Color to set as transparent. A suitable color value can be obtained by using the ARGB() method.

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);
}
See Also