Initializes a new ImageWatermark instance with a specified file path.
def__init__(self,file_path):...
Parameter
Type
Description
file_path
str
The path to the image that will be used as watermark.
Example
fromgroupdocs.watermark.watermarksimportImageWatermark# Initialize an image watermark from a file pathwatermark=ImageWatermark("logo.png")
init
Initializes a new ImageWatermark instance using the provided image stream.
def__init__(self,stream):...
Parameter
Type
Description
stream
io.RawIOBase
The stream containing the image that will be used as watermark.
Example
importiofromgroupdocs.watermarkimportWatermarkerfromgroupdocs.watermark.watermarksimportImageWatermark# Load image data into a memory streamwithopen("watermark.jpg","rb")asf:data=f.read()# Create a watermarker for the target documentwithWatermarker("document.docx")aswatermarker:# Initialize the image watermark from the streamwithImageWatermark(io.BytesIO(data))aswatermark:watermarker.add(watermark)watermarker.save("watermarked.docx")