GdPicture.NET Reference Guide
AutoTextInvert Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : AutoTextInvert Method
GdPicture Image Identifier. Only 1 bit per pixel images with black and white palette are supported.
Minimum width of the black background object.
Minimum height of the black background object.
Minimum percent of black pixels within the background object. Can be thought of as how much black space there needs to be where there is no white text.
Maximum percent of black pixels within the background object. Can be thought of as how much white text there needs to be in the black object.
Whether or not to despeckle the background after inverting it. Black objects are usually imperfectly scanned in low DPIs, resulting in holes which would appear as noise once inverted. Setting this to True would clean up this noise, but would also eliminate some characters if they are too small.
Whether or not the object is connected to lines as part of a table for example.
If ConnectedToLines is True, then you would need to specify the max thickness of those lines. A value between 1-5 is suggested.
Inverts white text with black background to become black text with white background.
Syntax
'Declaration
 
Public Function AutoTextInvert( _
   ByVal ImageID As Integer, _
   ByVal MinObjectWidth As Integer, _
   ByVal MinObjectHeight As Integer, _
   ByVal MinBlackPercent As Integer, _
   ByVal MaxBlackPercent As Integer, _
   ByVal FixBackground As Boolean, _
   ByVal ConnectedToLines As Boolean, _
   ByVal MaxLinesThickness As Integer _
) As GdPictureStatus

Parameters

ImageID
GdPicture Image Identifier. Only 1 bit per pixel images with black and white palette are supported.
MinObjectWidth
Minimum width of the black background object.
MinObjectHeight
Minimum height of the black background object.
MinBlackPercent
Minimum percent of black pixels within the background object. Can be thought of as how much black space there needs to be where there is no white text.
MaxBlackPercent
Maximum percent of black pixels within the background object. Can be thought of as how much white text there needs to be in the black object.
FixBackground
Whether or not to despeckle the background after inverting it. Black objects are usually imperfectly scanned in low DPIs, resulting in holes which would appear as noise once inverted. Setting this to True would clean up this noise, but would also eliminate some characters if they are too small.
ConnectedToLines
Whether or not the object is connected to lines as part of a table for example.
MaxLinesThickness
If ConnectedToLines is True, then you would need to specify the max thickness of those lines. A value between 1-5 is suggested.

Return Value

A member of the GdPictureStatus enumeration.
Example
Auto inverting white text.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.tif")
If imageId <> 0 Then
   If oGdPictureImaging.GetBitDepth(ImageID) <> 1 Then
      oGdPictureImaging.ConvertTo1BppAT(ImageID)
   End If
   oGdPictureImaging.AutoTextInvert(ImageID, 50, 20, 60, 95, True, False, 0)
   oGdPictureImaging.SaveAsTIFF(ImageID, "test.tif", TiffCompression.TiffCompressionCCITT4)
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members