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





In This Topic
CropWhiteBorders(Int32,Single,Int32) Method
In This Topic
Detects and removes margins consisting of white 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. It also has a SkipLinesCount which is the number of lines surrounding the image to be skipped and not considered as borders and removed.
Syntax
'Declaration
 
Public Overloads Function CropWhiteBorders( _
   ByVal ImageID As Integer, _
   ByVal Confidence As Single, _
   ByVal SkipLinesCount As Integer _
) As GdPictureStatus
public GdPictureStatus CropWhiteBorders( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
)
public function CropWhiteBorders( 
    ImageID: Integer;
    Confidence: Single;
    SkipLinesCount: Integer
): GdPictureStatus; 
public function CropWhiteBorders( 
   ImageID : int,
   Confidence : float,
   SkipLinesCount : int
) : GdPictureStatus;
public: GdPictureStatus CropWhiteBorders( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
) 
public:
GdPictureStatus CropWhiteBorders( 
   int ImageID,
   float Confidence,
   int SkipLinesCount
) 

Parameters

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

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 white margins from a jpeg 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.jpg", true);
 
    // Detect and remove the white margins using the custom parameters.
    gdpictureImaging.CropWhiteBorders(imageID, 99, 1);
    
    gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also