Visual Basic |
---|
Public Sub CropBorder( _ ByVal IPCropPct As Single, _ ByVal IPCropBorder As Integer _ ) |
- IPCropPct
- Single that evaluates to the crop percent as described in Remarks. Valid range is between 0.0 and 1.0 (percent).
- IPCropBorder
A CropBorder type value used in determining the type of crop to perform.
Value Description 0 Crop border background color. 1 Crop border foreground color. 2 Crop border black color. 3 Crop border white color.
Occasionally, scanned documents possess edges where the selected scan area falls outside of the scanned page. Use CropBorder method to remove these edges from images.
Use DocumentBorderCrop to remove unwanted edges from documents.
Beginning with the top row, each row is examined for pixels containing the border color. If the percentage pixels containing the border color in that row and its adjacent row is greater than IPCropPct, the row is eliminated and the next row is examined. The process continues until the number of pixels containing the border color is less than CropPct.
The same process is applied for rows from bottom to top and from the leftmost column to right and from the rightmost column to the left. The IPCropPct argument can be adjusted to compensate for noise that is typically found in scanned documents.
- For IPCropBorder = CropBorderBackgroundColor (0) and IPCropBorder = CropBorderForegroundColor (1), CropBorder attempts to determine whether the image is black on white or white on black by counting black and white pixels in a subsample of the image.
- If an image is known to have either black or white borders, then use IPCropBorder = CropBorderBlackColor (2) or IPCropBorder = CropBorderWhiteColor (3) settings, respectively.
VB Example using CropBorder (Visual Basic) | Copy Code |
---|---|
ImagXpress1.CropBorder0.9,2'Removebordersthatare90%ormoreblack. |