ConvertTo1BppBradley Method (GdPictureImaging)
Converts a GdPicture image to a 1-bit (black and white) bitmap using a modified Bradley adaptive thresholding method.
public function ConvertTo1BppBradley(
: Integer;
: Byte
): GdPictureStatus;
'Declaration
Public Function ConvertTo1BppBradley( _
ByVal As Integer, _
ByVal 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.
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);
}