WatermarkableImage class

WatermarkableImage class

Represents an image inside a document.

Learn more: https://docs.groupdocs.com/display/watermarknet/Adding+watermark+to+images+inside+a+document

The WatermarkableImage type exposes the following members:

Methods

Method Description
add Adds a watermark to this WatermarkableImage. This method assumes that watermark offset and size are measured in pixels (if they are assigned).
add_watermark
get_bytes Gets the image as a byte array.
find_images Finds images according to the specified search criteria. (inherited from ContentPart)
find_images_image_search_criteria (inherited from ContentPart)
search Finds possible watermarks according to the specified search criteria. (inherited from ContentPart)
search_search_criteria (inherited from ContentPart)

Properties

Property Description
height The height of this WatermarkableImage in pixels.
width The width of this WatermarkableImage in pixels.

Example

from groupdocs.watermark import Watermarker, TextWatermark, Font

with Watermarker(r"D:\input.doc") as watermarker:
    # Initialize text watermark.
    watermark = TextWatermark("DRAFT", Font("Arial", 19))

    # Find all images in the document.
    images = watermarker.get_images()

    # Add watermark to each image.
    for img in images:
        img.add(watermark)

    # Save changes.
    watermarker.save(r"D:\output.doc")

See Also