GdPicture.NET Reference Guide
SetColorKey Method
Example 





GdPicture14 Namespace > GdPictureImaging Class : SetColorKey Method
GdPicture Image Identifier.
Specifies the low color-key value. A suitable color value can be obtained by using the ARGB() method.
Specifies the high color-key value. A suitable color value can be obtained by using the ARGB() method.
Sets the color key (transparency range) for a specified category on a GdPicture image. This method sets the high and low color-key values so that a range of colors can be made transparent. Any color that has each of its three components (red, green, blue) between the corresponding components of the high and low color keys is made transparent.
Syntax
'Declaration
 
Public Function SetColorKey( _
   ByVal ImageID As Integer, _
   ByVal ColorLow As Color, _
   ByVal ColorHigh As Color _
) As GdPictureStatus
public function SetColorKey( 
    ImageID: Integer;
    ColorLow: Color;
    ColorHigh: Color
): GdPictureStatus; 
public function SetColorKey( 
   ImageID : int,
   ColorLow : Color,
   ColorHigh : Color
) : GdPictureStatus;

Parameters

ImageID
GdPicture Image Identifier.
ColorLow
Specifies the low color-key value. A suitable color value can be obtained by using the ARGB() method.
ColorHigh
Specifies the high color-key value. A suitable color value can be obtained by using the ARGB() method.

Return Value

A member of the GdPictureStatus enumeration.
Example
Making the values of the color channel green between 50 and 120 transparent.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   oGdPictureImaging.SetColorKey(ImageID, oGdPictureImaging.ARGB(255,0,50,0),oGdPictureImaging.ARGB(255,0,120,0))
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
ARGB(Byte,Byte,Byte) Method