Files
pptopic/README.md

90 lines
2.0 KiB
Markdown
Raw 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 演示文稿导出为长图的工具。
## 功能
- 📊 **PPT 转长图**:将 PPTX 文件导出为一张连续的长图
- 🖼️ **图片优化**:支持使用 `pngquant` 进行无损压缩
- ⚙️ **灵活配置**:可自定义输出尺寸、格式、保存路径等
## 环境要求
- **Windows 系统**(依赖 PowerPoint COM 接口)
- Python ≥ 3.13
- 已安装 Microsoft PowerPoint
## 安装
```bash
pip install pptopic
```
如需图片优化功能,请安装 `pngquant`
```bash
scoop install pngquant
```
也可以使用你熟悉的图片优化引擎替代 `pngquant` ,但一般情况下,我更推荐 `pngquant`
## 使用
### 导出长图
```bash
# 基本用法
pptopic export presentation.pptx
# 指定输出文件名和目录
pptopic export presentation.pptx -o result.png -d ./output
# 自定义宽度并启用优化
pptopic export presentation.pptx --width 1200 --optimize
```
### 优化图片
```bash
# 优化现有图片
pptopic optimize image.png
# 指定输出路径和最大高度
pptopic optimize image.png -o optimized.png --max-height 20000
```
## 命令选项
### export 命令
| 选项 | 简写 | 说明 |
|------|------|------|
| `--output` | `-o` | 输出文件名 |
| `--dir` | `-d` | 输出目录(默认当前目录) |
| `--width` | `-w` | 导出图片宽度(像素) |
| `--format` | `-f` | 输出格式JPG 或 PNG默认 PNG |
| `--optimize` | - | 启用图片优化 |
| `--max-height` | - | 优化时最大高度(默认 29999 |
### optimize 命令
| 选项 | 简写 | 说明 |
|------|------|------|
| `--output` | `-o` | 输出文件路径 |
| `--max-height` | - | 最大高度限制 |
| `--engine` | - | 优化引擎(默认 pngquant |
## 示例
```bash
# 导出并优化
pptopic export presentation.pptx --optimize
# 导出为 JPG 格式
pptopic export presentation.pptx -f JPG -o result
```
## 许可证
MIT License