set_image method
set_image(input_file_name, output_file_name, watermark_image_file_name)
Adds an image watermark into the document.
def set_image(self, input_file_name: str, output_file_name: str, watermark_image_file_name: str):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_file_name, output_file_name, watermark_image_file_name, options)
Adds an image watermark into the document with options.
def set_image(self, input_file_name: str, output_file_name: str, watermark_image_file_name: str, options: aspose.words.ImageWatermarkOptions):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
| options | ImageWatermarkOptions | Defines additional options for the image watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_file_name, output_file_name, save_format, watermark_image_file_name)
Adds an image watermark into the document with options and specified save format.
def set_image(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_image_file_name: str):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| save_format | SaveFormat | The save format. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_file_name, output_file_name, save_format, watermark_image_file_name, options)
Adds an image watermark into the document with options and specified save format.
def set_image(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_image_file_name: str, options: aspose.words.ImageWatermarkOptions):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| save_format | SaveFormat | The save format. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
| options | ImageWatermarkOptions | Defines additional options for the image watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_file_name, output_file_name, save_options, watermark_image_file_name)
Adds an image watermark into the document with options and specified save format.
def set_image(self, input_file_name: str, output_file_name: str, save_options: aspose.words.saving.SaveOptions, watermark_image_file_name: str):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| save_options | SaveOptions | The save options. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_file_name, output_file_name, save_options, watermark_image_file_name, options)
Adds an image watermark into the document with options and specified save format.
def set_image(self, input_file_name: str, output_file_name: str, save_options: aspose.words.saving.SaveOptions, watermark_image_file_name: str, options: aspose.words.ImageWatermarkOptions):
...
| Parameter | Type | Description |
|---|---|---|
| input_file_name | str | The input file name. |
| output_file_name | str | The output file name. |
| save_options | SaveOptions | The save options. |
| watermark_image_file_name | str | Image that is displayed as a watermark. |
| options | ImageWatermarkOptions | Defines additional options for the image watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
set_image(input_stream, output_stream, save_format, watermark_image_stream)
def set_image(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_format: aspose.words.SaveFormat, watermark_image_stream: io.BytesIO):
...
| Parameter | Type | Description |
|---|---|---|
| input_stream | io.BytesIO | |
| output_stream | io.BytesIO | |
| save_format | SaveFormat | |
| watermark_image_stream | io.BytesIO |
set_image(input_stream, output_stream, save_format, watermark_image_stream, options)
def set_image(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_format: aspose.words.SaveFormat, watermark_image_stream: io.BytesIO, options: aspose.words.ImageWatermarkOptions):
...
| Parameter | Type | Description |
|---|---|---|
| input_stream | io.BytesIO | |
| output_stream | io.BytesIO | |
| save_format | SaveFormat | |
| watermark_image_stream | io.BytesIO | |
| options | ImageWatermarkOptions |
set_image(input_stream, output_stream, save_options, watermark_image_stream)
def set_image(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_options: aspose.words.saving.SaveOptions, watermark_image_stream: io.BytesIO):
...
| Parameter | Type | Description |
|---|---|---|
| input_stream | io.BytesIO | |
| output_stream | io.BytesIO | |
| save_options | SaveOptions | |
| watermark_image_stream | io.BytesIO |
set_image(input_stream, output_stream, save_options, watermark_image_stream, options)
def set_image(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_options: aspose.words.saving.SaveOptions, watermark_image_stream: io.BytesIO, options: aspose.words.ImageWatermarkOptions):
...
| Parameter | Type | Description |
|---|---|---|
| input_stream | io.BytesIO | |
| output_stream | io.BytesIO | |
| save_options | SaveOptions | |
| watermark_image_stream | io.BytesIO | |
| options | ImageWatermarkOptions |
Examples
Shows how to insert watermark image to the document.
doc = MY_DIR + 'Document.docx'
watermark_image = IMAGE_DIR + 'Logo.jpg'
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkImage.1.docx', watermark_image_file_name=watermark_image)
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.2.docx', save_format=aw.SaveFormat.DOCX, watermark_image_file_name=watermark_image)
options = aw.ImageWatermarkOptions()
options.scale = 50
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.3.docx', watermark_image_file_name=watermark_image, options=options)
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.4.docx', save_format=aw.SaveFormat.DOCX, watermark_image_file_name=watermark_image, options=options)
See Also
- module aspose.words.lowcode
- class Watermarker