GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / CropBlackBorders Method / CropBlackBorders(Int32,Single) Method
GdPicture image identifier.
Confidence threshold in percentage 0-100. Default value is 75.
Example





In This Topic
CropBlackBorders(Int32,Single) Method
In This Topic
Detects and removes margins consisting of black color around a GdPicture image. It has a Confidence Parameter where if the lines and borders detection confidence exceeds this value they will be removed, and left as they are if the confidence in detecting them is less than the Confidence Parameter Value.
Syntax
'Declaration
 
Public Overloads Function CropBlackBorders( _
   ByVal ImageID As Integer, _
   ByVal Confidence As Single _
) As GdPictureStatus
public GdPictureStatus CropBlackBorders( 
   int ImageID,
   float Confidence
)
public function CropBlackBorders( 
    ImageID: Integer;
    Confidence: Single
): GdPictureStatus; 
public function CropBlackBorders( 
   ImageID : int,
   Confidence : float
) : GdPictureStatus;
public: GdPictureStatus CropBlackBorders( 
   int ImageID,
   float Confidence
) 
public:
GdPictureStatus CropBlackBorders( 
   int ImageID,
   float Confidence
) 

Parameters

ImageID
GdPicture image identifier.
Confidence
Confidence threshold in percentage 0-100. Default value is 75.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method or an overload of it is used in the "Image Processing" Demo.

This method requires the Image Documents component to run.

This method requires the Image Documents component to run.

Example
Removing the black margins from 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 remove the black margins using the custom confidence level.
    gdpictureImaging.CropBlackBorders(imageID, 99);
    
    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also