GdPicture image identifier.
Thresholding for determining the foreground. Must be a value between 0 and 100. Suggested value is 50. Higher is the Thresold value darker should be the resulting image.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / ConvertTo1BppAT Method / ConvertTo1BppAT(Int32,Int32) Method

ConvertTo1BppAT(Int32,Int32) Method

In This Topic
Converts a GdPicture image to a 1-bit (black and white) bitmap using a variant of the Otsu adaptive thresholding method. This method is particularly efficient on documents with contrasted foreground and background.
Syntax
'Declaration

 

Public Overloads Function ConvertTo1BppAT( _

   ByVal ImageID As Integer, _

   ByVal Threshold As Integer _

) As GdPictureStatus
public GdPictureStatus ConvertTo1BppAT( 

   int ImageID,

   int Threshold

)
public function ConvertTo1BppAT( 

    ImageID: Integer;

    Threshold: Integer

): GdPictureStatus; 
public function ConvertTo1BppAT( 

   ImageID : int,

   Threshold : int

) : GdPictureStatus;
public: GdPictureStatus ConvertTo1BppAT( 

   int ImageID,

   int Threshold

) 
public:

GdPictureStatus ConvertTo1BppAT( 

   int ImageID,

   int Threshold

) 

Parameters

ImageID
GdPicture image identifier.
Threshold
Thresholding for determining the foreground. Must be a value between 0 and 100. Suggested value is 50. Higher is the Thresold value darker should be the resulting image.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method requires the Image Documents component to run.

Example
Converting the image to black and white using a variant of the Otsu adaptive thresholding methods.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())

{

    // LoadInMemory parameter is set to true in order to be able to update the input file.

    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);

 

    //Convert to black and white.

    gdpictureImaging.ConvertTo1BppAT(imageID, 45);

    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionAUTO);

    gdpictureImaging.ReleaseGdPictureImage(imageID);

}
See Also