Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / ConvertTo8BppGrayScale Method
GdPicture image identifier.
Example





In This Topic
    ConvertTo8BppGrayScale Method (GdPictureImaging)
    In This Topic
    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