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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
watermark_image_file_namestrImage 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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
watermark_image_file_namestrImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines 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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_formatSaveFormatThe save format.
watermark_image_file_namestrImage 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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_formatSaveFormatThe save format.
watermark_image_file_namestrImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines 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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_optionsSaveOptionsThe save options.
watermark_image_file_namestrImage 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):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_optionsSaveOptionsThe save options.
watermark_image_file_namestrImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines 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):
    ...
ParameterTypeDescription
input_streamio.BytesIO
output_streamio.BytesIO
save_formatSaveFormat
watermark_image_streamio.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):
    ...
ParameterTypeDescription
input_streamio.BytesIO
output_streamio.BytesIO
save_formatSaveFormat
watermark_image_streamio.BytesIO
optionsImageWatermarkOptions

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):
    ...
ParameterTypeDescription
input_streamio.BytesIO
output_streamio.BytesIO
save_optionsSaveOptions
watermark_image_streamio.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):
    ...
ParameterTypeDescription
input_streamio.BytesIO
output_streamio.BytesIO
save_optionsSaveOptions
watermark_image_streamio.BytesIO
optionsImageWatermarkOptions

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