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
Converts selected image to an 8-bit gray-scaled indexed color image, and saves result into a TIF file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Open an image file. An empty string allows the control to prompt for selecting a file.
    int imageId = gdpictureImaging.CreateGdPictureImageFromFile("");
 
    gdpictureImaging.ConvertTo8BppGrayScale(imageId);
    gdpictureImaging.SaveAsTIFF(imageId, "output.tif", TiffCompression.TiffCompressionAUTO);
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId);
}
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
ConvertTo8BppGrayScaleAdv Method