GdPicture.NET Reference Guide
ConvertTo4BppPal Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : ConvertTo4BppPal Method
GdPicture Image Identifier.
Array of Color Objects. All color entries of the palette.
Converts a GdPicture image to a 4-bit indexed color image using custom color palette. The color table has a maximum of 16 entries.
Syntax
'Declaration
 
Public Function ConvertTo4BppPal( _
   ByVal ImageID As Integer, _
   ByVal ColorEntries() As Color _
) As GdPictureStatus
public GdPictureStatus ConvertTo4BppPal( 
   int ImageID,
   Color[] ColorEntries
)
public function ConvertTo4BppPal( 
    ImageID: Integer;
    ColorEntries: Colorarray of
): GdPictureStatus; 
public function ConvertTo4BppPal( 
   ImageID : int,
   ColorEntries : Color[]
) : GdPictureStatus;
public: GdPictureStatus ConvertTo4BppPal( 
   int ImageID,
   Color[]* ColorEntries
) 
public:
GdPictureStatus ConvertTo4BppPal( 
   int ImageID,
   array<Color>^ ColorEntries
) 

Parameters

ImageID
GdPicture Image Identifier.
ColorEntries
Array of Color Objects. All color entries of the palette.

Return Value

A member of the GdPictureStatus enumeration.
Example
Converting the image to a 4-bit per pixel image that has a custom color palette.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   Dim Palette(3) As Color
   Palette(0) = Imaging1.ARGB(255, 0, 0, 0)
   Palette(1) = Imaging1.ARGB(255, 128, 128, 128)
   Palette(2) = Imaging1.ARGB(255, 255, 255, 255)
   oGdPictureImaging.ConvertTo4BppPal(ImageID, Palette)
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members