Files
pptopic/README.md

87 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pptopic
将 PowerPoint 演示文稿导出为长图的工具。
## 功能
- 将 PPTX 文件的所有幻灯片垂直拼接为一张长图
- 支持 JPG 和 PNG 格式输出
- 支持自定义输出宽度和目录
- 内置图片优化功能,使用图片优化引擎进行无损压缩
## 安装
### 安装 uv
```bash
# 使用 scoop
scoop install uv
```
### 安装 pptopic
```bash
uv pip install -e .
```
## 使用
### 导出 PPTX 为长图
```bash
# 基本用法
pptopic export presentation.pptx
# 指定输出文件名
pptopic export presentation.pptx --output result.png
# 优化导出的图片
pptopic export presentation.pptx --optimize
# 自定义宽度和最大高度
pptopic export presentation.pptx --width 1080 --optimize --max-height 20000
```
### 单独优化图片
```bash
# 优化图片
pptopic optimize image.png
# 指定输出文件
pptopic optimize image.png --output optimized.png
# 自定义优化参数
pptopic optimize image.png --max-height 20000 --engine pngquant
```
## 系统要求
- Windows 系统(使用 win32com 调用 PowerPoint
- Python >= 3.13
- Microsoft PowerPoint
## 图片优化
推荐使用 [pngquant](https://pngquant.org/) 进行图片压缩。
### 自动安装脚本
使用提供的 PowerShell 脚本自动安装 pngquant
```powershell
.\install-pngquant.ps1
```
该脚本会自动:
1. 检查 pngquant 是否已安装
2. 如果未安装,检查 scoop 是否已安装
3. 如果 scoop 未安装,自动安装 scoop
4. 使用 scoop 安装 pngquant
### 手动安装
```bash
scoop install pngquant
```