Extract images and videos from PowerPoint presentations
Project description
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 Extract-Media-PowerPoint
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pptmedia-1.0.1.tar.gz.
File metadata
- Download URL: pptmedia-1.0.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95cc5952bc9f5bbbd86d1d4605d8f51ca36398cc61af87325f4eb7222af8b62f
|
|
| MD5 |
91379217e33c1117cde4cc12f3190a44
|
|
| BLAKE2b-256 |
444e5958aaadfc1035853aa5a33050c7b0091c5752cbdec87c145d33522afea9
|
Provenance
The following attestation bundles were made for pptmedia-1.0.1.tar.gz:
Publisher:
ci.yml on madyel/pptmedia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pptmedia-1.0.1.tar.gz -
Subject digest:
95cc5952bc9f5bbbd86d1d4605d8f51ca36398cc61af87325f4eb7222af8b62f - Sigstore transparency entry: 1155030038
- Sigstore integration time:
-
Permalink:
madyel/pptmedia@1c48118d9cec2fb89e552d25783d6aaa533ebb6f -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/madyel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1c48118d9cec2fb89e552d25783d6aaa533ebb6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pptmedia-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pptmedia-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89abb310dcb14ee2aef2ea3907cefac1ee6c469f667583bd87ce626eb8cff384
|
|
| MD5 |
5266df085af66384762c0297abe49094
|
|
| BLAKE2b-256 |
5d90c107fd1c88ee4858059edbe444c65c3fbdefff6d6d8c46c583433d6c832b
|
Provenance
The following attestation bundles were made for pptmedia-1.0.1-py3-none-any.whl:
Publisher:
ci.yml on madyel/pptmedia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pptmedia-1.0.1-py3-none-any.whl -
Subject digest:
89abb310dcb14ee2aef2ea3907cefac1ee6c469f667583bd87ce626eb8cff384 - Sigstore transparency entry: 1155030041
- Sigstore integration time:
-
Permalink:
madyel/pptmedia@1c48118d9cec2fb89e552d25783d6aaa533ebb6f -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/madyel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1c48118d9cec2fb89e552d25783d6aaa533ebb6f -
Trigger Event:
push
-
Statement type: