GdPicture.NET Reference Guide
ConvertTo8BppGrayScale Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : ConvertTo8BppGrayScale Method
GdPicture Image Identifier.
Converts a GdPicture image to an 8-bit gray-scaled indexed color image. The color table has 256 entries.
Syntax
'Declaration
 
Public Function ConvertTo8BppGrayScale( _
   ByVal ImageID As Integer _
) As GdPictureStatus
public GdPictureStatus ConvertTo8BppGrayScale( 
   int ImageID
)
public function ConvertTo8BppGrayScale( 
    ImageID: Integer
): GdPictureStatus; 
public function ConvertTo8BppGrayScale( 
   ImageID : int
) : GdPictureStatus;
public: GdPictureStatus ConvertTo8BppGrayScale( 
   int ImageID
) 
public:
GdPictureStatus ConvertTo8BppGrayScale( 
   int ImageID
) 

Parameters

ImageID
GdPicture Image Identifier.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method uses a basic grayscale color reduction algorithm, where all three color channels rgb have the weight.
Example
Converting the image into a grayscale image.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   oGdPictureImaging.ConvertTo8BppGrayScale(ImageID)
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
ConvertTo8BppGrayScaleAdv Method