ImageGear .NET v25.0 - Updated
InvertWhiteText(ImGearPage,Int32,Int32,Int32,Int32,Int32,Int32) Method
Example 




ImageGear.Processing.Advanced Assembly > ImageGear.Processing.ImageClean Namespace > ImGearIC Class > InvertWhiteText Method : InvertWhiteText(ImGearPage,Int32,Int32,Int32,Int32,Int32,Int32) Method
1-bit ImGearPage object to apply the method to.
Specifies the minimum width for areas that you would like to invert.
Specifies the minimum height for areas that you would like to invert. For example, if you set minX = 60 and minY = 20, ImageGear will only invert sections of white text on black background that have a minimum width of 60 pixels and a minimum height of 20 pixels.
Specifies the minimum "thickness" of spaces that fall between sections of text that will be inverted. This minimum value indicates those sections of text to be treated as one section based on how close they are to one another. As an example, let's say you have three adjacent sections of white text on black backgrounds that contain the words, "There," "is," and "hope." If "There" and "hope" meet your minimum size requirements they will be inverted. If "is" is below your minimum size requirements, and you have not set minT, "is" will note be inverted, resulting in "There" and "hope" looking normal, while "is" remains white text on black background. To prevent this (if desired), you would need to set minT to a value small enough to include the spaces before and after the word "is." This way, all the words would be treated as one section and inverted together.
Specifies the minimum size of the white letters to be inverted.
Specifies the maximum size of the white letters to be inverted.
Specifies the size of the maximum border around the letter that will be inverted along with the letter cell. For example, if width and height of the letter cell are 20 and 30 respectively and maxBorder = 10, then the width and the height of the rectangle that will be inverted are 40 (10+20+10) and 50 (10+30+10) respectively. Please be careful when setting this parameter. If it is very large, it is possible that incorrect image areas will be inverted.
Detects and inverts areas of white text on black background.
Syntax
'Declaration
 
Public Overloads Shared Sub InvertWhiteText( _
   ByVal page As ImGearPage, _
   ByVal minWidth As Integer, _
   ByVal minHeight As Integer, _
   ByVal minThickness As Integer, _
   ByVal minLetterSize As Integer, _
   ByVal maxLetterSize As Integer, _
   ByVal maxBorderSize As Integer _
) 
'Usage
 
Dim page As ImGearPage
Dim minWidth As Integer
Dim minHeight As Integer
Dim minThickness As Integer
Dim minLetterSize As Integer
Dim maxLetterSize As Integer
Dim maxBorderSize As Integer
 
ImGearIC.InvertWhiteText(page, minWidth, minHeight, minThickness, minLetterSize, maxLetterSize, maxBorderSize)
public static void InvertWhiteText( 
   ImGearPage page,
   int minWidth,
   int minHeight,
   int minThickness,
   int minLetterSize,
   int maxLetterSize,
   int maxBorderSize
)
public: static void InvertWhiteText( 
   ImGearPage* page,
   int minWidth,
   int minHeight,
   int minThickness,
   int minLetterSize,
   int maxLetterSize,
   int maxBorderSize
) 
public:
static void InvertWhiteText( 
   ImGearPage^ page,
   int minWidth,
   int minHeight,
   int minThickness,
   int minLetterSize,
   int maxLetterSize,
   int maxBorderSize
) 

Parameters

page
1-bit ImGearPage object to apply the method to.
minWidth
Specifies the minimum width for areas that you would like to invert.
minHeight
Specifies the minimum height for areas that you would like to invert. For example, if you set minX = 60 and minY = 20, ImageGear will only invert sections of white text on black background that have a minimum width of 60 pixels and a minimum height of 20 pixels.
minThickness
Specifies the minimum "thickness" of spaces that fall between sections of text that will be inverted. This minimum value indicates those sections of text to be treated as one section based on how close they are to one another. As an example, let's say you have three adjacent sections of white text on black backgrounds that contain the words, "There," "is," and "hope." If "There" and "hope" meet your minimum size requirements they will be inverted. If "is" is below your minimum size requirements, and you have not set minT, "is" will note be inverted, resulting in "There" and "hope" looking normal, while "is" remains white text on black background. To prevent this (if desired), you would need to set minT to a value small enough to include the spaces before and after the word "is." This way, all the words would be treated as one section and inverted together.
minLetterSize
Specifies the minimum size of the white letters to be inverted.
maxLetterSize
Specifies the maximum size of the white letters to be inverted.
maxBorderSize
Specifies the size of the maximum border around the letter that will be inverted along with the letter cell. For example, if width and height of the letter cell are 20 and 30 respectively and maxBorder = 10, then the width and the height of the rectangle that will be inverted are 40 (10+20+10) and 50 (10+30+10) respectively. Please be careful when setting this parameter. If it is very large, it is possible that incorrect image areas will be inverted.
Remarks
This method takes a 1-bit ImGearPage and a set of parameters specifying a minimum width of the region to be considered, a minimum height of the region to be considered, a minimum "thickness" of spaces that fall in between sections of text that will be inverted, and the minimum and maximum sizes of the white letters to be inverted, and automatically detects areas of white text on black backgrounds, and inverts them so that they become black text on white backgrounds. The letter size means the maximum value of width and height of the letter cell that is the minimum rectangle that completely covers the letter and the argument that sets a size of the maximum border around the letter that will be inverted along with the letter cell.

This method scans your entire image and makes adjustments to all areas of white text on black that fall within the scope of your settings.

Example
// Invert sections of white text on black background in the image using 
// a minimum height of 10, width of 30, thickness of 10,
// minimum letter size of 10, maximum letter size of 100, and a maximum
// border of 5.
ImGearIC.InvertWhiteText(igPage, 40, 100, 10, 10, 100, 5);
' Invert sections of white text on black background in the image using 
' a minimum height of 10, width of 30, thickness of 10,
' minimum letter size of 10, maximum letter size of 100, and a maximum
' border of 5.
ImGearIC.InvertWhiteText(igPage, 40, 100, 10, 10, 100, 5)
See Also

Reference

ImGearIC Class
ImGearIC Members
Overload List
ImGearPage Class