This example shows how to deskew an image. (It also shows how to invoke other functions that can prepare an image for OCR processing.)
Private Sub cmdCleanup_Click()
'Perform automatic straighten on the image
ImgEdit1.AutoDeskew
'Remove speckles on the image using the default
'threshold value for dot size
ImgEdit1.Despeckle
'If there is a lot of extraneous space around image
'borders, cropping might reduce processing time
ImgEdit1.AutoCrop
'Show the OCR dialog box
ImgOCR1.ShowOCR
End Sub