A Python script to automatically add watermarks to all slides in PowerPoint presentations. Supports both standard positioning and ribbon-style watermarks that span across slides.
Website: Add Watermark to PowerPoint
- Multiple positioning options: Standard corners, center, or full ribbon styles
- Smart ribbon sizing: Automatically adjusts ribbon height based on watermark aspect ratio
- Opacity control: Set transparency from 0% to 100%
- Aspect ratio preservation: No image stretching or distortion
- Layering control: Place watermarks on top or underneath slide content
- Batch processing: Applies watermark to all slides at once
- Clone or download this repository
- Install dependencies:
pip install -r requirements.txt
from main import add_watermark_to_pptx
# Simple watermark in bottom-right corner
add_watermark_to_pptx(
pptx_path="your_presentation.pptx",
watermark_path="your_logo.png"
)
- Python 3.7+
- python-pptx>=1.0.2
- Pillow>=10.0.0
center
- Center of slidebottom-right
- Bottom right corner with marginbottom-left
- Bottom left corner with margintop-right
- Top right corner with margintop-left
- Top left corner with margin
diagonal-ribbon
- Diagonal ribbon across entire slidehorizontal-ribbon
- Horizontal ribbon across slide widthvertical-ribbon
- Vertical ribbon across slide height
Parameter | Type | Default | Description |
---|---|---|---|
pptx_path |
str | Required | Path to input PowerPoint file |
watermark_path |
str | Required | Path to watermark image |
output_path |
str | None |
Output file path (auto-generated if None) |
opacity |
float | 0.5 |
Watermark opacity (0.0 to 1.0) |
position |
str | "center" |
Watermark position (see options above) |
size_percentage |
float | 0.3 |
Size relative to slide width (ignored for ribbons) |
on_top |
bool | True |
Whether watermark appears above content |
add_watermark_to_pptx(
pptx_path="presentation.pptx",
watermark_path="company_logo.png",
opacity=0.7,
position="bottom-right",
size_percentage=0.15
)
add_watermark_to_pptx(
pptx_path="sensitive_doc.pptx",
watermark_path="confidential.png",
output_path="confidential_presentation.pptx",
opacity=0.3,
position="diagonal-ribbon"
)
add_watermark_to_pptx(
pptx_path="presentation.pptx",
watermark_path="background_logo.png",
opacity=0.1,
position="center",
size_percentage=0.5,
on_top=False # Behind content
)
add_watermark_to_pptx(
pptx_path="brand_presentation.pptx",
watermark_path="brand_banner.png",
opacity=0.4,
position="horizontal-ribbon"
)
The script automatically adjusts ribbon height based on your watermark's aspect ratio:
- Wide images (width/height > 2.5): 20% of slide height
- Normal/tall images: 35% of slide height
This ensures wide text watermarks don't create overly tall ribbons, while square logos get appropriate prominence.
Unlike simple image insertion, this script:
- ✅ Maintains original image proportions
- ✅ Scales appropriately for different positions
- ✅ Prevents stretching or distortion
- ✅ Automatically calculates optimal dimensions
- For text watermarks: Use wide PNG images with transparent backgrounds
- For logo watermarks: Square or vertical orientations work best for ribbons
- Opacity suggestions:
- Logos: 0.7-1.0
- Background watermarks: 0.1-0.3
- Text overlays: 0.3-0.6
- File formats: PNG with transparency recommended for best results
Import errors: Make sure you're in the virtual environment:
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
Watermark too big/small: Adjust size_percentage
for standard positions or check your image's aspect ratio for ribbons.
Watermark not visible: Check opacity
setting and ensure on_top=True
if you want it above content.
This project is open source. Feel free to modify and distribute as needed.
Need help? Check the examples above or examine the script's docstrings for detailed parameter information.