GdPicture.NET.14 (COM - ActiveX)~GdPicture14_namespace / GdPicture.NET.14 (COM - ActiveX)~GdPicture14.GdPictureImaging / ConvertTo1Bpp_2 Method
GdPicture image identifier.
Value between [1 and 255]. Pixels values less than Threshold will be turned black, values equal to or larger till be turned white. If you do not know what to choose, select 128 which is the medium value.
Example





In This Topic
    ConvertTo1Bpp_2 Method (GdPictureImaging)
    In This Topic
    Converts a GdPicture image to a 1-bit BW indexed color image specifying a threshold value. The color table has 2 entries: 1 Black & 1 White.
    Syntax
    'Declaration
     
    
    Public Function ConvertTo1Bpp_2( _
       ByVal ImageID As Integer, _
       ByVal Threshold As Byte _
    ) As GdPictureStatus
    public GdPictureStatus ConvertTo1Bpp_2( 
       int ImageID,
       byte Threshold
    )
    public function ConvertTo1Bpp_2( 
        ImageID: Integer;
        Threshold: Byte
    ): GdPictureStatus; 
    public function ConvertTo1Bpp_2( 
       ImageID : int,
       Threshold : byte
    ) : GdPictureStatus;
    public: GdPictureStatus ConvertTo1Bpp_2( 
       int ImageID,
       byte Threshold
    ) 
    public:
    GdPictureStatus ConvertTo1Bpp_2( 
       int ImageID,
       byte Threshold
    ) 

    Parameters

    ImageID
    GdPicture image identifier.
    Threshold
    Value between [1 and 255]. Pixels values less than Threshold will be turned black, values equal to or larger till be turned white. If you do not know what to choose, select 128 which is the medium value.

    Return Value

    A member of the GdPictureStatus enumeration.
    Remarks
    The pixel value of colored pixels is computed via the following formula: PixValue = (0.2126F * r + 0.7152F * g + 0.0722F * b)
    Example
    Converts selected image to a 1-bit BW 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.ConvertTo1Bpp(imageID, 128);
        gdpictureImaging.SaveAsTIFF(imageID, "output.tif", TiffCompression.TiffCompressionAUTO);
     
        // Release used resources.
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    See Also

    Reference

    GdPicture.NET.14 (COM - ActiveX)~GdPicture14.GdPictureImaging
    GdPictureImaging Members
    FxBlackNWhite(Int32,BitonalReduction) Method
    FxBlackNWhiteT Method