GdPicture.NET Reference Guide
AutoDeskew(Int32,Single,Color) Method
Example 





GdPicture14 Namespace > GdPictureImaging Class > AutoDeskew Method : AutoDeskew(Int32,Single,Color) Method
GdPicture Image Identifier.
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.
Color to use to fill background. A suitable color value can be obtained by using the ARGB() method.
Tries to deskew a GdPicture image to about ± specified degrees. This method enables to specify the background color to use. Deskewing an image can help a lot to do OCR, OMR, barcode detection or just improve the readability of an image.
Syntax

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.
BackColor
Color to use to fill background. A suitable color value can be obtained by using the ARGB() method.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
Deskewing often results in "padding" surrounding the image where the dimensions of the image were extended because of the rotation. This method offers a fill color for this padding, so that if you specify it to be the same as the original background color, the deformities would not show.
Example
Using AutoDeskew on an image with max angle of 10 is considered for investigation with green as a background color.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   oGdPictureImaging.AutoDeskew(ImageID, 10, oGdPictureImaging.ARGB(255,0,255,0))
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
Overload List
GetSkewAngle(Int32) Method