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





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / PaletteSetTransparentColor Method

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 Color _
) As GdPictureStatus
public GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   Color TransparentColor
)
public function PaletteSetTransparentColor( 
    ImageID: Integer;
    TransparentColor: Color
): GdPictureStatus; 
public function PaletteSetTransparentColor( 
   ImageID : int,
   TransparentColor : Color
) : GdPictureStatus;
public: GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   Color TransparentColor
) 
public:
GdPictureStatus PaletteSetTransparentColor( 
   int ImageID,
   Color 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