CropBlackBordersEx(Int32,Single) 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 the same.
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.
Syntax
Parameters
- ImageID
- GdPicture image identifier.
- Confidence
- Confidence threshold in percentage. Default value is 75.
Return Value
A member of the GdPictureStatus enumeration.
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 confidence level.
gdpictureImaging.CropBlackBordersEx(imageID, 99);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
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 confidence level.
gdpictureImaging.CropBlackBordersEx(imageID, 99);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also