GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / ConvertTo1BppSauvola Method / ConvertTo1BppSauvola(Int32,Single) Method
GdPicture image identifier.
Factor of thresholding reduction. Must be a balue in tha range ]0 ; 1. Suggested value is 0.35. Higher is the factor value lighter should be the resulting image.
Example





In This Topic
ConvertTo1BppSauvola(Int32,Single) Method
In This Topic
Converts a GdPicture image to a 1-bit (black and white) bitmap using the Sauvola local adaptive thresholding method. This method is particularly efficient on documents with poor contrast.
Syntax
'Declaration
 
Public Overloads Function ConvertTo1BppSauvola( _
   ByVal ImageID As Integer, _
   ByVal Factor As Single _
) As GdPictureStatus
public GdPictureStatus ConvertTo1BppSauvola( 
   int ImageID,
   float Factor
)
public function ConvertTo1BppSauvola( 
    ImageID: Integer;
    Factor: Single
): GdPictureStatus; 
public function ConvertTo1BppSauvola( 
   ImageID : int,
   Factor : float
) : GdPictureStatus;
public: GdPictureStatus ConvertTo1BppSauvola( 
   int ImageID,
   float Factor
) 
public:
GdPictureStatus ConvertTo1BppSauvola( 
   int ImageID,
   float Factor
) 

Parameters

ImageID
GdPicture image identifier.
Factor
Factor of thresholding reduction. Must be a balue in tha range ]0 ; 1. Suggested value is 0.35. Higher is the factor value lighter should be the resulting image.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method requires the Image Documents component to run.

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.ConvertTo1BppSauvola(imageID, 0.35f);
    gdpictureImaging.SaveAsTIFF(imageID, "output.tif", TiffCompression.TiffCompressionAUTO);
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also