Extract Media PowerPoint
A lightweight Python library to extract images and videos from PowerPoint (.pptx) presentations, with optional filtering by media type, file extension, and automatic organization by slide number.
Features
- Extract all embedded media (images and videos) from a
.pptxfile - Extract filtered media by type (
imageorvideo) and custom extensions - Output organized in subdirectories by slide number
- Supports custom output directories
- Built on top of
python-pptx
Requirements
- Python >= 3.10
- lxml >= 6.0.2
- Pillow >= 12.1.1
- python-pptx >= 1.0.2
Installation
pip install pptmedia
Quick Start
Extract all media (no filtering)
from extract import PowerPointMediaExtractor
extractor = PowerPointMediaExtractor(
filepath="presentation.pptx",
output_dir="output"
)
count = extractor.extract_all_media()
print(f"Extracted {count} media files")
Files are saved under output/ppt/media/.
Extract images filtered by extension
from extract import PowerPointMediaExtractor
extractor = PowerPointMediaExtractor(
filepath="presentation.pptx",
media_type="image",
output_dir="output",
extensions=["png", "jpg"]
)
count = extractor.extract_filtered_media()
Files are saved under output/<slide_number>/ppt/media/.
Extract videos
from extract import PowerPointMediaExtractor
extractor = PowerPointMediaExtractor(
filepath="presentation.pptx",
media_type="video",
output_dir="output",
extensions=["mp4", "avi"]
)
count = extractor.extract_filtered_media()
API Reference
PowerPointMediaExtractor
PowerPointMediaExtractor(
filepath: str | Path,
media_type: str = "image", # "image" or "video"
output_dir: str | Path = "temp",
extensions: list[str] | None = None,
)
| Parameter | Type | Default | Description |
|---|---|---|---|
filepath |
str | Path |
— | Path to the .pptx file |
media_type |
str |
"image" |
Media type to extract: "image" or "video" |
output_dir |
str | Path |
"temp" |
Directory where media will be saved |
extensions |
list[str] | None |
None |
Allowed extensions (defaults to all for the media type) |
Default extensions:
| Type | Default extensions |
|---|---|
image |
png, jpeg, jpg, bmp, svg |
video |
mp4, avi, mpg, mpeg, wmv |
Methods
| Method | Returns | Description |
|---|---|---|
extract_all_media() |
int |
Extracts all embedded media, returns count |
extract_filtered_media() |
int |
Extracts media filtered by type/extension, organized by slide |
MediaInfo
Dataclass representing a media item found in the presentation.
@dataclass
class MediaInfo:
shape_id: int
filename: str
slide_number: int
Logging
The library uses Python's standard logging module under the logger name extract.service. To see output:
import logging
logging.basicConfig(level=logging.INFO)
License
MIT — see LICENSE.txt.
Metadata
Release files for pptmedia 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pptmedia-1.0.2.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pptmedia-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / pptmedia-1.0.2.tar.gz
| Download URL | pptmedia-1.0.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68ed5b547e292cf6321746c1f991e3f486bbf004733ad83942d59c910d0da9b5
|
|
BLAKE2b-256 checksum How to use checksums |
133bb88ea811fcacd437ec4d459079d9e305664b67f5ebe29a86fbfa0f126fcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency logRelease files / pptmedia-1.0.2-py3-none-any.whl
| Download URL | pptmedia-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7947ffd933fc6cfc62e7dd90a56522262e1b87e20df4c150089fbca2eb560ee1
|
|
BLAKE2b-256 checksum How to use checksums |
192bf3b573c52c4ad3a289b5ebd01c967b432967ed09a00cb4f69344067bd717
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency log