__init__ constructor
Leave feedback
On this page
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. |
from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import ImageWatermark
with Watermarker("document.docx") as watermarker:
watermark = ImageWatermark("logo.png")
watermarker.add(watermark)
watermarker.save("watermarked.docx")
```
## __init__ {#stream}
Initializes a new ImageWatermark with the provided image stream.
```python
def __init__(self, stream):
...
| Parameter | Type | Description |
|---|---|---|
| stream | io.RawIOBase |
The stream containing the image that will be used as a watermark. |
import io
from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import ImageWatermark
with open("logo.png", "rb") as f:
image_data = f.read()
with Watermarker("sample.docx") as watermarker:
with ImageWatermark(stream=io.BytesIO(image_data)) as watermark:
watermarker.add(watermark)
watermarker.save("watermarked.docx")
- class
ImageWatermark
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.