The angle of skewing of an image can be corrected by using the DeskewDIB and DeskewDIBWithoutBlackBorder functions/methods of the BiDocImg DLL/OCX.
[C++]
/* Deskewing an image*/
#include “BiDocImg.h”
HDIB hDibNew;
/* 1. parameter: Handle of the DIB to filter
2. parameter: Paper white or black
3. parameter: Show progress
4. parameter: Handle of parent window
5. parameter: Fill background after rotate */
hDibNew = DeskewDIB(hDib, TRUE, TRUE,
AfxGetMainWnd()->m_hWnd, TRUE);
if (!hDibNew)
{
// Error
}
[C#]
/* Deskewing an image*/
long hDibNew;
/* 1. parameter: Handle of the DIB to filter
2. parameter: Paper white or black
3. parameter: Show progress
4. parameter: Fill background after rotate */
hDibNew = BiDocImg.DeskewDIB(hDib, true, true, true);
if (hDibNew == 0)
{
// Error
}