# PPTX

> Create, modify, and analyze PowerPoint presentations (.pptx) using standard Python libraries.

- Skill: `vietanhdev/pptx` (Agent Skill)
- Install (CLI): `npx skillmds@latest add vietanhdev/pptx`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vietanhdev/pptx/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- License: Apache-2.0
- Author: vietanhdev (https://skillmd.com/u/vietanhdev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/vietanhdev/pptx

---


# PPTX Skill

This skill enables programmatic creation and modification of PowerPoint presentations (.pptx) using Python.

## Core Capabilities

1.  **Create New Presentations**: Generate structured slide decks from templates or scratch.
2.  **Modify Existing Decks**: Update text, replace images, or add new slides to existing files.
3.  **Read Content**: Inspect slide layouts, shapes, and text content.

## Dependencies

*   `python-pptx` (pip install python-pptx)
*   `Pillow` (pip install Pillow) for image handling

## Workflows

### 1. Creating a New Presentation

```python
from pptx import Presentation
from pptx.util import Inches

prs = Presentation()

# Title Slide
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Hello World"
subtitle.text = "Generated by python-pptx"

# Content Slide
bullet_slide_layout = prs.slide_layouts[1]
slide = prs.slides.add_slide(bullet_slide_layout)
shapes = slide.shapes

title_shape = shapes.title
body_shape = shapes.placeholders[1]

title_shape.text = 'Key Points'
tf = body_shape.text_frame
tf.text = 'First bullet point'
p = tf.add_paragraph()
p.text = 'Second bullet point'
p.level = 1

prs.save('output.pptx')
```

### 2. Modifying an Existing Presentation

```python
from pptx import Presentation

prs = Presentation('template.pptx')

# Modify Title on first slide
if prs.slides[0].shapes.title:
    prs.slides[0].shapes.title.text = "Updated Title"

# Add a valid image to slide 2 (if exists)
img_path = 'image.png'
if len(prs.slides) > 1:
    slide = prs.slides[1]
    left = top = Inches(1)
    slide.shapes.add_picture(img_path, left, top)

prs.save('modified.pptx')
```

### 3. Reading and Analyzing

```python
from pptx import Presentation

prs = Presentation('input.pptx')

print(f"Total Slides: {len(prs.slides)}")
for i, slide in enumerate(prs.slides):
    print(f"Slide {i+1} Shapes:")
    for shape in slide.shapes:
        if shape.has_text_frame:
            print(f"  - Text: {shape.text}")
```

## Best Practices

*   **Templates**: Use existing templates (`.pptx` files) for complex layouts rather than creating shapes from scratch.
*   **Placeholders**: Identify placeholders by index (`prs.slide_layouts[n]`) or name.
*   **Images**: Ensure images are available locally before insertion.

