GdPicture image identifier.
Max distance in pixels from edges of image a border is allowed to start. Suggested value is 10.
Whether the borders are skewed or not. Meaning if the borders are not uniform in size, such that their width changes along the y-axis if they are vertical borders, or their height changes along the x-axis if they are horizontal borders, or both. Suggested value is false.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / DeleteBlackBorders Method

DeleteBlackBorders Method (GdPictureImaging)

In This Topic
Deletes black borders of a document image by replacing them with white content.
Syntax
'Declaration
 
Public Function DeleteBlackBorders( _
   ByVal ImageID As Integer, _
   ByVal Margin As Integer, _
   ByVal SkewedBorders As Boolean _
) As GdPictureStatus
public GdPictureStatus DeleteBlackBorders( 
   int ImageID,
   int Margin,
   bool SkewedBorders
)
public function DeleteBlackBorders( 
    ImageID: Integer;
    Margin: Integer;
    SkewedBorders: Boolean
): GdPictureStatus; 
public function DeleteBlackBorders( 
   ImageID : int,
   Margin : int,
   SkewedBorders : boolean
) : GdPictureStatus;
public: GdPictureStatus DeleteBlackBorders( 
   int ImageID,
   int Margin,
   bool SkewedBorders
) 
public:
GdPictureStatus DeleteBlackBorders( 
   int ImageID,
   int Margin,
   bool SkewedBorders
) 

Parameters

ImageID
GdPicture image identifier.
Margin
Max distance in pixels from edges of image a border is allowed to start. Suggested value is 10.
SkewedBorders
Whether the borders are skewed or not. Meaning if the borders are not uniform in size, such that their width changes along the y-axis if they are vertical borders, or their height changes along the x-axis if they are horizontal borders, or both. Suggested value is false.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method is used in the "Image Processing" and "Document Clean Up" C# Demo.

It is highly suggested to use AutoDeskew() before calling this method if the image or the borders are skewed, if that is not an option, setting this parameter to True will try to overcome the borders without overcoming the document content. But as skewed borders could easily overlap with document content, the method might become overzealous and delete some document content.

This method requires the Image Documents component to run.

Example
Deleting black borders 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);
 
    // Delete black borders from a skewed image by replacing them with white content.
    // The max distance in pixels from edges of an image where a border is allowed to start is 10 pixels.
    gdpictureImaging.DeleteBlackBorders(imageID, 10, true);
    
    gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also