RemoveColorObjectsEx Method of the ImageDocument Object

This method removes from the image all color objects of the specified hues and replaces them with the specified color. It also allows you to save a separate image containing only the extracted objects.

Important! This method can be used for color images only.



HRESULT RemoveColorObjectsEx(
  IIntsCollection* ColorHues,
  int              BackgroundColor,
  IImage**         ColorLayer


Image RemoveColorObjectsEx(
  IIntsCollection ColorHues,
  int            BackgroundColor

Visual Basic .NET

Function RemoveColorObjectsEx( _
  ColorHues As IIntsCollection, _
  BackgroundColor As Integer _
) As Image


[in] Refers to the IntsCollection object which contains a collection of the hues of the objects which must be filtered, in HSL representation. You may pass null for this parameter, in which case all colored objects are removed, and only the gray image remains.
The number which specifies a hue must be in range from 0 to 255. The value 0 corresponds to red color, 43 — to yellow, 85 — to green, 171 — to blue, 213 — to purple.
[in] Specifies the color which must replace the removed color objects. If you pass -1 for this parameter, the background color is determined automatically.
[out, retval] A pointer to the IImage* pointer variable that receives the interface pointer of the output Image object which contains the extracted color objects.

Return values

This method has no specific return values. It returns the standard return values of ABBYY FineReader Engine functions.


This method applies color filtering to the color image plane of the ImageDocument. All the other pages are deleted from the ImageDocument. They will be created upon demand.

There is also a special preprocessing mode which performs the same kind of color objects filtering before recognizing the image and can restore them automatically before export: IPageProcessingParams::ProhibitColorObjectsAtProcessing. Choose the most acceptable setting for your scenario.

See also


24.03.2023 8:51:52

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.