Chinese Simplified (简体中文)

PrepareImageMode Object (IPrepareImageMode Interface)

This object contains different attributes specifying how an image will be prepared during conversion to the internal format. All properties of a newly created object of this type are set to reasonable defaults. To know about the default value of this or that property, see its description. The sequence of the transformations upon the prepared image is the following: first the rotation is performed, and then the image is mirrored.

The PrepareImageMode object is a persistent object. This means that the object's current state can be written to persistent storage on disk. Later, the object can be re-created by reading the object's state from persistent storage. The following methods provide persistence of the object: SaveToFile, and LoadFromFile.

Properties

Name Type Description
Application Engine, read-only Returns the Engine object.
Main settings
BackgroundFillingColor int

Specifies the color used for filling the areas which are added to the image after skew correction.

The default value of this property is -1, which means that the color is determined by ABBYY FineReader Engine automatically.

Note: The int value is calculated from the RGB triplet using the formula: (red value) + (256 x green value) + (65536 x blue value), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component. For example, the int value of the color white equals 16777215.

BinarizationThreshold int

This property is used for fine-tuning of the brightness threshold during image preprocessing: the pixels with brightness higher than the threshold will be replaced with white pixels, the rest with black. The value of this property may be in the range from 0 to 255.

The default value of this property is -1, which means that the binarization threshold is determined by ABBYY FineReader Engine automatically.

Important! The value of this property is taken into account only if the DiscardColorImage property is set to TRUE.

CorrectSkew VARIANT_BOOL

This property set to TRUE tells ABBYY FineReader Engine to correct skew during image preparation. The type of skew correction is defined by the CorrectSkewMode property.

If this property is set to FALSE, the value of the CorrectSkewMode property is ignored.

By default, this property is set to TRUE.

CorrectSkewMode int

Specifies the mode of skew correction. The value of this property is an OR superposition of the CorrectSkewModeEnum enumeration constants which denote the types of skew correction. 0 means do not correct skew.

The value of this property is ignored, if the CorrectSkew property is set to FALSE.

By default, this property is set to CSM_CorrectSkewByHorizontalText | CSM_CorrectSkewByVerticalText.

EnhanceLocalContrast VARIANT_BOOL

Specifies whether the local contrast of the image should be increased. Such preprocessing may increase the quality of recognition.

Important! Setting this property to TRUE is meaningful for color and gray images only.

By default, this property is set to FALSE.

InvertImage VARIANT_BOOL

This property set to TRUE tells ABBYY FineReader Engine to invert colors of the prepared image.

By default, this property is set to FALSE.

KeepOriginalCoordinatesInfo VARIANT_BOOL This property is deprecated and will be deleted in future versions.
MirrorImage VARIANT_BOOL

This property set to TRUE tells ABBYY FineReader Engine to mirror the prepared image around its vertical axis.

By default, this property is set to FALSE.

OfficeConversionSettings OfficeConversionSettings, read-only Provides access to the settings for importing digital documents using the same methods that open the images.
PhotoProcessingMode PhotoProcessingModeEnum

Specifies whether the processing image should be treated as a photo. If a photo is processed, FineReader Engine uses special algorithms for such image on different stages of image processing.

By default, this property is PPM_Auto, which means that FineReader Engine should define automatically whether the image is a photo.

RasterizeFreeText VARIANT_BOOL

Specifies whether Free Text annotations from the input PDF document should be retained.

By default, this property is set to FALSE.

Important! Before using this property, make sure the Arial or Liberation Sans font is arranged on your workstation.

Rotation RotationTypeEnum

This property specifies the rotation angle to apply to the image during preparation.

It specifies no rotation by default.

Resolution overwriting
AutoOverwriteResolution VARIANT_BOOL

Specifies whether resolution of the prepared image should be automatically overwritten. The property is only available if the value of the OverwriteResolution property is FALSE. If this property is set to TRUE, ABBYY FineReader Engine will automatically detect and overwrite image resolution. The new resolution will be applied before all other stages of image preparation (such as binarization, skew correction, etc.).

Notes:

  • If you set this property to FALSE and resolution of the prepared image is too low (less than 50 dpi), too high (more than 3200 dpi), or undefined, you should use the OverwriteResolution, XResolutionToOverWrite, and YResolutionToOverwrite properties to correct image resolution; otherwise, the image will not be opened and an error will result.
  • If you are opening a PDF file, the new resolution will be used for image rasterization; image size in pixels may be modified according to the detected resolution and the page dimensions.

By default, the value of the property is TRUE.

OverwriteResolution VARIANT_BOOL

Allows you to overwrite resolution of the prepared image. The resolution is overwritten depending on the values of the XResolutionToOverwrite and YResolutionToOverwrite properties. In this case, the new resolution will be applied before other stages of image preparation (i.e., binarization, deskewing, etc.). Image resolution can be overwritten automatically (see the description of the AutoOverwriteResolution property). See also IImageDocument::ChangeResolution, which allows you to correct image resolution after it was converted to internal format.

Note: If you set this property to TRUE and a PDF file is prepared, the resolution specified in the XResolutionToOverwrite and YResolutionToOverwrite properties will be used for rasterization of the PDF image. This means that:

  • XResolutionToOverwrite and YResolutionToOverwrite must be equal; otherwise, an error will be returned;
  • image size in pixels may be modified according to the specified resolution and the page dimensions.

By default, this property is set to FALSE.

XResolutionToOverwrite int

Specifies the horizontal resolution of the original image in dpi. This value is used to overwrite resolution of the prepared image when resolution of the original image is not defined or incorrect and only if the OverwriteResolution property is TRUE. ABBYY FineReader Engine works only with the images for which horizontal and vertical resolutions are the same, therefore the program stretches the image so that the horizontal and vertical resolutions of the prepared image are identical and equal to the maximum of XResolutionToOverwrite and YResolutionToOverwrite.

By default, this property is set to 300.

YResolutionToOverwrite int

Specifies the vertical resolution of the original image in dpi. This value is used to overwrite resolution of the prepared image when resolution of the original image is not defined or incorrect and only if the OverwriteResolution property is TRUE. ABBYY FineReader Engine works only with the images for which horizontal and vertical resolutions are the same, therefore the program stretches the image so that the horizontal and vertical resolutions of the prepared image are identical and equal to the maximum of XResolutionToOverwrite and YResolutionToOverwrite.

By default, this property is set to 300.

Creating image planes
CompressImage ThreeStatePropertyValueEnum

Specifies if the image should be compressed during conversion to the internal format. Only color and gray images may be compressed. ZIP compression is used.

By default, this property is set to TSPV_Auto, which currently means that only the gray or color images obtained from PDF files with text layer will be compressed.

CreatePreview VARIANT_BOOL

This property set to TRUE tells ABBYY FineReader Engine to create preview page for the prepared image.

By default, this property is set to FALSE.

DiscardColorImage VARIANT_BOOL

This property set to TRUE tells ABBYY FineReader Engine to leave only black-and-white plane in the prepared image. In this case, image binarization is performed during image preparation.

By default, this property is set to FALSE.

PreviewHeight int

Specifies the height in pixels of the preview page. This property is valid only if the CreatePreview property is TRUE; otherwise, it is ignored.

By default, this property is set to 90.

PreviewWidth int

Specifies the width in pixels of the preview page. This property is valid only if the CreatePreview property is TRUE; otherwise, it is ignored.

By default, this property is set 64.

UseFastBinarization VARIANT_BOOL

If this property is TRUE, ABBYY FineReader Engine will use algorithms for fast image binarization. Binarization is performed either when the image is loaded (if the DiscardColorImage is TRUE during preparation), or later when a black-and-white image is necessary (e.g., when you call the IImageDocument::BlackWhiteImage property for an open image document for the first time). This property set to TRUE will speed up binarization; however, its quality may deteriorate.

By default, the value of this property is FALSE.

Methods

Name Description
CopyFrom Initializes properties of the current object with values of similar properties of another object.
LoadFromFile Restores the object contents from a file on disk.
SaveToFile Saves the object contents into a file on disk.

Related objects

Object Diagram

Output parameter

This object is the output parameter of the CreatePrepareImageMode method of the Engine object.

Input parameter

This object is passed as an input parameter to the following methods:

Samples

The object is used in the following code samples: CommandLineInterface.

See also

Working with Images

Working with Properties

03.07.2024 8:50:25

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.