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





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / ConvertTo1BppBradley Method

ConvertTo1BppBradley Method (GdPictureImaging)

In This Topic
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
public GdPictureStatus ConvertTo1BppBradley( 

   int ImageID,

   byte Threshold

)
public function ConvertTo1BppBradley( 

    ImageID: Integer;

    Threshold: Byte

): GdPictureStatus; 
public function ConvertTo1BppBradley( 

   ImageID : int,

   Threshold : byte

) : GdPictureStatus;
public: GdPictureStatus ConvertTo1BppBradley( 

   int ImageID,

   byte Threshold

) 
public:

GdPictureStatus ConvertTo1BppBradley( 

   int ImageID,

   byte Threshold

) 

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