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.
Example





In This Topic

AutoTextInvert Method (GdPictureImaging)

In This Topic
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
public function AutoTextInvert( 
    ImageID: Integer;
    MinObjectWidth: Integer;
    MinObjectHeight: Integer;
    MinBlackPercent: Integer;
    MaxBlackPercent: Integer;
    FixBackground: Boolean;
    ConnectedToLines: Boolean;
    MaxLinesThickness: Integer
): GdPictureStatus; 
public function AutoTextInvert( 
   ImageID : int,
   MinObjectWidth : int,
   MinObjectHeight : int,
   MinBlackPercent : int,
   MaxBlackPercent : int,
   FixBackground : boolean,
   ConnectedToLines : boolean,
   MaxLinesThickness : int
) : 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
Inverting white text with black background to become black text with white background within a tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // LoadInMemory parameter is set to true in order to be able to update the input file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
 
    // Invert white text with black background.
    gdpictureImaging.AutoTextInvert(imageID, 100, 100, 60, 100, true, false, 1);
    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also