C2BW_SetAttributes

Specifies the color-to-BW conversion settings.

Syntax

bool C2BW_SetAttributes(string BitsPerPixel, string Palette, string Dither)

Parameters

string BitsPerPixel

string Palette

string Dither

Parameters

Requires 3 numeric values to configure the output image specifications:
  1. Bits per pixel - 1, 4, 8, 24. A bit depth of 1 will produce a black and white image. A bit depth of 4, 8 or 24 will produce a grayscale or color image depending on the selected palette.
  2. Palette - 0 Optimized, 1 Fixed, 2 Grayscale.
  3. Dither - 0 None, 1 Floyd-Steinberg, 2 Ordered, 3 Optimized.

Smart parameters are supported.

Returns

Always True.

Level

All levels.

Details

Adjusts the output of the action C2BW_Convert. Optionally called before C2BW_Convert to configure the desired image output specifications. If this action is not called, these default values are used by C2BW_Convert:
  • BitsPerPixel = 1 (Black and White)
  • Palette = 0 (Optimized)
  • Dither = 0 (None)

Choosing the right settings

The bits per pixel determine the final color depth of the image. For performing recognition of text pages, black and white work best, which has a bit depth of 1. If you need to preserve the original color images for uploading to a repository at the end of the process, the original image exists and can be uploaded. If you wish to recognize in black and white but present the color image to the user in the verify panel, that is also possible. If you perform additional enhancements after conversion to black and white but prior to recognition, enhancements such as deskew or border removal can change the text coordinates. The result is that field coordinates shown on the screen of the color image may not exactly match the coordinates from the black and white image.

Important: Recognition works best when the letters are crisp and have a clean background. Text surrounded by shading dots is difficult to recognize accurately. Choosing a dither of None is typically the best choice. Light colored backgrounds are removed, providing a clean area around letters. Choosing any of the other dither types converts backgrounds to dots. If performing recognition on the page, avoid a dot shaded background.

In rarer cases color images may have a dark colored background that is not cleanly removed when converted to black and white. If this occurs, it is typically best to use the image enhancement features to clean up the image before or after the black and white conversion. They are more versatile than directly converting to black and white with C2BW_Convert. Some image enhancement features require a color image and some require a black and white image. The "Binarize" property lets you control when to convert to black and white in the image enhancement process.

Please refer Best Practices for optimal text recognition.
Example
C2BW_SetAttributes("1","0","3")
C2BW_Convert(tic)