Add Watermark to PPT Presentation using Python
Build your own Python apps to insert text or image watermark into PPT, PPTX, or ODP presentation using server-side APIs.
Add Watermark to PPT Presentation via Python
Using Aspose.Slides for Python via .NET, you can add watermark to PPT presentation. Watermarks are an essential part of any presentation. They are used to protect the content of the presentation from being copied or used without permission. A watermark is a visible or invisible image or text that is placed on top of the presentation. It can be used to identify the owner of the presentation and to prevent unauthorized use. Watermarks can also be used to add a professional touch to the presentation and to make it look more polished.
Add Text Watermark to PPT using Python
import aspose.slides as slides
import aspose.pydrawing as draw
with slides.Presentation() as pres:
master = pres.masters[0]
watermarkShape = master.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 0, 0, 100, 100)
watermarkTextFrame = watermarkShape.add_text_frame("Watermark")
# Lock Watermark from Editing
watermarkShape.shape_lock.select_locked = True
watermarkShape.shape_lock.size_locked = True
watermarkShape.shape_lock.text_locked = True
watermarkShape.shape_lock.position_locked = True
watermarkShape.shape_lock.grouping_locked = True
# Set Text Watermark Transparency
watermarkPortion = watermarkTextFrame.paragraphs[0].portions[0]
watermarkPortion.portion_format.fill_format.fill_type = slides.FillType.SOLID
watermarkPortion.portion_format.fill_format.solid_fill_color.color = draw.Color.from_argb(150, 200, 200, 200)
# Set Font Size of Text Watermark
watermarkPortion.portion_format.font_height = 16
pres.save("watermark.ppt", slides.export.SaveFormat.PPT)
Add Image Watermark to PPT Presentation using Python
import aspose.slides as slides
with slides.Presentation() as presentation:
with open("image1.png", "rb") as fs:
data = fs.read()
image = presentation.images.add_image(data)
master = presentation.masters[0]
watermarkShape = master.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 0, 0, image.width, image.height)
watermarkShape.fill_format.fill_type = slides.FillType.PICTURE
watermarkShape.fill_format.picture_fill_format.picture.image = image
watermarkShape.fill_format.picture_fill_format.picture_fill_mode = slides.PictureFillMode.STRETCH
presentation.save("watermark2.ppt", slides.export.SaveFormat.PPT)
How to Add Watermark to PPT via Python
These are the steps to add text watermark to PPT files.
Load PPT with an instance of Presentation
Select the master presentation
Add shape type using AddAutoShape method
Add watermark text using AddTextFrame method
Save result in PPT format