GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / ConvertTo1BppBradley Method
GdPicture image identifier.
Value between [0 and 254]. Specifies the aggressiveness of the method. Suggested value is 38. Higher is the value, whiter the resulting bitmap will be.
Example





ConvertTo1BppBradley Method (GdPictureImaging)
Converts a GdPicture image to a 1-bit (black and white) bitmap using a modified Bradley adaptive thresholding method.
Syntax
'Declaration
 
Public Function ConvertTo1BppBradley( _
   ByVal ImageID As Integer, _
   ByVal Threshold As Byte _
) As GdPictureStatus
 

Parameters

ImageID
GdPicture image identifier.
Threshold
Value between [0 and 254]. Specifies the aggressiveness of the method. Suggested value is 38. Higher is the value, whiter the resulting bitmap will be.

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 modified Bradley 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);
 
    // Specify the aggressiveness of the method. The higher value, the whiter the result.
    byte threshold = 120;
 
    // Convert to black and white.
    gdpictureImaging.ConvertTo1BppBradley(imageID, threshold);
    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also