WordProcessingImageEffects class

WordProcessingImageEffects class

Represents effects that can be applied to an image watermark for a Word document.

The WordProcessingImageEffects type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the WordProcessingImageEffects class.

Properties

Property Description
border_line_format The line format settings for the image border. (inherited from OfficeImageEffects)
brightness The brightness of the picture. Must be a float between 0.0 (dimmest) and 1.0 (brightest). The default value is 0.5. (inherited from OfficeImageEffects)
chroma_key The color value of the image that will be treated as transparent. The default value is a fully transparent color. (inherited from OfficeImageEffects)
contrast The contrast for the specified picture. Must be a float between 0.0 (least contrast) and 1.0 (greatest contrast). The default value is 0.5. (inherited from OfficeImageEffects)
gray_scale The property indicates whether a picture will be displayed in grayscale mode. (inherited from OfficeImageEffects)

Example

from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import ImageWatermark, Color
from groupdocs.watermark.options.word_processing import (
    WordProcessingLoadOptions, WordProcessingWatermarkSectionOptions, WordProcessingImageEffects,
)

def add_watermark_with_effects():
    with Watermarker("./document.docx", WordProcessingLoadOptions()) as watermarker:
        with ImageWatermark("./logo.png") as watermark:
            effects = WordProcessingImageEffects()
            effects.brightness = 0.7
            effects.contrast = 0.6
            effects.chroma_key = Color.red

            options = WordProcessingWatermarkSectionOptions()
            options.name = "Shape 1"
            options.alternative_text = "Company logo watermark"
            options.effects = effects
            watermarker.add(watermark, options)

        watermarker.save("./output.docx")

if __name__ == "__main__":
    add_watermark_with_effects()

See Also