CropBlackBorders(Int32,Single,Int32) 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.
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 CropBlackBorders( _
ByVal As Integer, _
ByVal As Single, _
ByVal As Integer _
) As GdPictureStatus
public GdPictureStatus CropBlackBorders(
int ,
float ,
int
)
public function CropBlackBorders(
: Integer;
: Single;
: Integer
): GdPictureStatus;
public function CropBlackBorders(
: int,
: float,
: int
) : GdPictureStatus;
public: GdPictureStatus CropBlackBorders(
int ,
float ,
int
)
public:
GdPictureStatus CropBlackBorders(
int ,
float ,
int
)
Parameters
- ImageID
- GdPicture image identifier.
- Confidence
- Confidence threshold in percentage 0-100. 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.
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 parameters.
gdpictureImaging.CropBlackBorders(imageID, 99, 1);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
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 parameters.
gdpictureImaging.CropBlackBorders(imageID, 99, 1);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also