ClearImage COM API
AdvancedBinarize Method
CiRepair Object : AdvancedBinarize Method
0                     converts to 300 DPI
-1                    preserves current DPI
100 to 600      converts to specified DPI
Set to 0.0
Set to 0.0
Description
Optimized conversion of color and grayscale image to a bi-tonal image.
Syntax
Visual Basic
Public Sub AdvancedBinarize( _
   Optional ByVal targetDpi As Long = 0, _
   Optional ByVal reserved1 As Double = 0, _
   Optional ByVal reserved2 As Double = 0 _
) 
Parameters
targetDpi
0                     converts to 300 DPI
-1                    preserves current DPI
100 to 600      converts to specified DPI
reserved1
Set to 0.0
reserved2
Set to 0.0
Remarks
This method utilizes multiple image analysis techniques.  It is significantly slower than CiImage.ToBitonal method and recommended when original image has a complex background.
Example
Sub RepairMethods(imageFile As String, imageFileOut As String)
    ' Create objects and open input images
  Dim Ci As New CiServer
  Dim Repair As CiRepair: Set Repair = Ci.CreateRepair
  Repair.Image.Open imageFile
    ' Do Processing
  Repair.AutoDeskew                  ' Use AutoDeskew before AutoRotate
  Repair.AutoRotate
  '  Repair.AutoCrop 10, 10, 10, 10  ' Do not use AutoCrop with AutoRegister or BorderExtract
  '  Repair.AutoRegister 100, 100    ' Do not use AutoRegister with AutoCrop or BorderExtract
  Repair.AdvancedBinarize 0, 0, 0
  Repair.BorderExtract ciBexBorderDeskewCrop, ciBeaCleaner
  Repair.RemovePunchHoles
  Repair.SmoothCharacters ciSmoothDarkenEdges
  Repair.CleanNoise 3                ' Use CleanNoiseExt to remove white noise
  '  Repair.CleanNoiseExt (ciCnxBlackNoise + ciCnxWhiteNoise), 3, 3, 10, 0
  Repair.pLineCurvature = ciCurvLow
  Repair.pMaxLineAngle = 5
  Repair.pMaxLineGap = 5
  Repair.pMinLineLength = 200
  Repair.DeleteLines ciLineVertAndHorz, ciTrue
  Repair.Image.SaveAs imageFileOut, ciEXT
End Sub
See Also

CiRepair Object  | CiRepair Members