ImageModification Object (IImageModification Interface)
This object is used to store parameters of image modification. Method IImageDocument::Modify that is used to modify an image, together with some other methods, takes a reference to this object as an input parameter. The ImageModification allows a wide range of operations upon an image, such as stretching, setting clip regions, inversion regions, paint regions, replace pixels regions, remove garbage regions. The image is modified as follows:
- The color of text and the size of garbage in regions is determined.
- Image part inside the clipping regions is cut.
- "Paint" regions are filled in with the corresponding color.
- Colors inside the "invert" regions are inverted.
- Black dots inside the "replace black pixels" regions are replaced with the dots of the corresponding color.
- White dots inside the "replace white pixels" regions are replaced with the dots of the corresponding color.
- The garbage inside the "remove garbage" regions is cleaned up. This modification can be applied only to the black-and-white image plane.
- Image is stretched with the stretch ratio defined by the StretchRatio property.
All regions that are added inside this object should not exceed the bounds of the image rectangle.
The ImageModification object is a persistent object. This means that the object's current state can be written to persistent storage: an area in the global memory or a disk file. 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, LoadFromFile, SaveToMemory, and LoadFromMemory.
Properties
Name | Type | Description |
---|---|---|
Application | Engine, read-only | Returns the Engine object. |
StretchRatio | double |
Specifies the stretch ratio to apply to the image. By default, this property is 1.0 that corresponds to no stretch. |
Methods
Name | Description |
---|---|
AddClipRegion | Adds new clipping region to the internal array of clipping regions. |
AddInvertRegion | Adds new inversion region to the internal array of inversion regions. |
AddPaintRegion | Adds new paint region to the internal array of paint regions. |
AddRemoveGarbageRegion | Adds new "remove garbage" region to the internal array of "remove garbage" regions. |
AddReplaceBlackPixelsRegion | Adds new "replace black pixels" region to the internal array of "replace black pixels" regions. |
AddReplaceWhitePixelsRegion | Adds new "replace white pixels" region to the internal array of "replace white pixels" regions. |
ClearClipRegions | Clears the internal array of clipping regions. |
ClearInvertRegions | Clears the internal array of inversion regions. |
ClearPaintRegions | Clears the internal array of paint regions. |
ClearRemoveGarbageRegions | Clears the internal array of "remove garbage" regions. |
ClearReplaceBlackPixelsRegions | Clears the internal array of "replace black pixels" regions. |
ClearReplaceWhitePixelsRegions | Clears the internal array of "replace white pixels" regions. |
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. |
LoadFromMemory | Restores the object contents from the global memory. |
SaveToFile | Saves the object contents into a file on disk. |
SaveToMemory | Saves the object contents into the global memory. |
Output parameter
This object is the output parameter of the CreateImageModification method of the Engine object.
Input parameter
This object is passed as an input parameter to the following methods:
- EstimateBitmapSize, GetBitmap, WriteToFile of the Image object,
- Modify of the ImageDocument object.
Samples
C# code
The object is used in the following demo tools: Image Preprocessing.
See also
17.09.2024 15:14:40