GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / CropBlackBordersEx Method / CropBlackBordersEx(Int32,Single,Int32) Method
GdPicture image identifier.
Confidence threshold in percentage. Default value is 75.
Specifies the number of lines around the image which must be ignored.
Example





In This Topic
CropBlackBordersEx(Int32,Single,Int32) Method
In This Topic
Detects and sets to White, margins consisting of black color around a GdPicture image. This method does not have the same behavior as the CropBlackBorders() method: The black borders are not removed but are set to blank. Therefore, the image dimensions are kept. It has a Confidence Parameter where if the lines and borders detection confidence exceeds this value they will be set as blank, and left as they are if the confidence in detecting them is less than the Confidence Parameter Value. It also has a SkipLinesCount which is the number of lines surrounding the image to be skipped and not considered as borders to be set as blanked. This method only detects rectangular borders, for all types of borders, please use DeleteBlackBorders() instead.
Syntax
'Declaration
 
Public Overloads Function CropBlackBordersEx( _
   ByVal ImageID As Integer, _
   ByVal Confidence As Single, _
   ByVal SkipLinesCount As Integer _
) As GdPictureStatus
public GdPictureStatus CropBlackBordersEx( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
)
public function CropBlackBordersEx( 
    ImageID: Integer;
    Confidence: Single;
    SkipLinesCount: Integer
): GdPictureStatus; 
public function CropBlackBordersEx( 
   ImageID : int,
   Confidence : float,
   SkipLinesCount : int
) : GdPictureStatus;
public: GdPictureStatus CropBlackBordersEx( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
) 
public:
GdPictureStatus CropBlackBordersEx( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
) 

Parameters

ImageID
GdPicture image identifier.
Confidence
Confidence threshold in percentage. Default value is 75.
SkipLinesCount
Specifies the number of lines around the image which must be ignored.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method only detects rectangular borders, for all types of borders, including ones that are resultant from deskewing, or bad scanning, please use DeleteBlackBorders() instead.

This method requires the Image Documents component to run.

Example
Whitening the black margins on a black and white tiff image.
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);
 
    // Detect and set to white the black margins using the custom parameters.
    gdpictureImaging.CropBlackBordersEx(imageID, 99, 1);
    
    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also