Generally, there are two ways to automatically deskew an image. Method No.1 - Use Dynamic Web TWAIN's built-in methods. Below are the basic steps:
- Calculate the skew angle by using GetSkewAngle Method.
Angle = DWObject.GetSkewAngle(DWObject.CurrentImageIndexInBuffer);
- Use Rotate method to de-skew the image.
If you want to do de-skew to each scanned image, you can call the above code in OnPostTransfer event.
Method No.2 - Use custom capability of the scanner, which requires the support of the scanner itself.
DWObject.Capability = 4433; //AutoDeskew DWObject.CapType = 5; //TWON_ONEVALUE DWObject.CapValue = 0; bRet = DWObject.CapSet();