AutoDeskew(Int32,Single) Method
Tries to deskew a GdPicture image to about ± specified degrees.
Deskewing an image can help a lot to do OCR, OMR, barcode detection or just improve the readability
of an image.
'Declaration
Public Overloads Function AutoDeskew( _
ByVal As Integer, _
ByVal As Single _
) As GdPictureStatus
Parameters
- ImageID
- GdPicture image identifier.
- MaxAngleOfResearch
- Maximum angle of research. IE: set 10 to perform a skew research
about ±10 degrees. A value lower than 15 is suggested. Value used by other overloads is 15.
Return Value
A member of the GdPictureStatus enumeration.
Deskewing a tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("skewed.tif");
gdpictureImaging.AutoDeskew(imageID, 10);
// Let's encode the new tiff with the same mode used by the input image.
TiffCompression tiffCompression = gdpictureImaging.GetTiffCompression(imageID);
gdpictureImaging.SaveAsTIFF(imageID, "deskewed.tif", tiffCompression);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}