RegionReplacementOptions class

RegionReplacementOptions class

Represents color and area parameters for image region replacement.

Learn more:

The RegionReplacementOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new RegionReplacementOptions instance.
init Initializes a new instance of RegionReplacementOptions class which size matches given text.

Properties

Property Description
fill_color The color used to fill the redacted area.
size The rectangle width and height.

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import ImageAreaRedaction, RegionReplacementOptions
from groupdocs.pydrawing import Color, Point, Size

with Redactor("test.jpg") as redactor:
    # Define the top‑left position of the area to replace
    point = Point(516, 311)
    # Define the size of the area to replace
    size = Size(170, 35)
    # Use a solid black rectangle as the replacement
    repl_opt = RegionReplacementOptions(Color.BLACK, size)
    redaction = ImageAreaRedaction(point, repl_opt)

    result = redactor.apply(redaction)
    if result.status != redactor.RedactionStatus.FAILED:
        redactor.save()

Guides

Task guides that use RegionReplacementOptions:

See Also