ai-image2academic-ppt converts slide screenshots (and optional speaker notes) into editable PowerPoint files using multimodal AI.
Many AI tools can now generate academic-style PPT images with decent layouts — our advisor endorses and recommends using GPT for this purpose — but the text content often contains errors and there is no easy way to fix it afterward. This project bridges that gap by converting AI-generated academic slide images back into fully editable PPTX files.
How to use: Provide AI-generated slide images (optionally with your generation prompt or PPT outline as context), and configure a multimodal model API that supports image understanding:
| Model | Characteristics | Cost per slide |
|---|---|---|
| Gemini | Better adherence to the original layout, fewer manual edits | ~¥1/slide |
| MiMo | Free credits, very low token cost, nearly free | ~¥0.01/slide |
Cost estimates above are rough figures based on limited testing and are for reference only.
Built with Codex and MiMoCode; MiMoCode's Compose mode was slow but surprisingly effective.
| Input (AI-generated slide image) | Output (editable PPTX) |
|---|---|
![]() |
![]() |
PNG/JPG screenshots + optional same-name TXT speaker notes
→ Multimodal model analyzes layout and generates HTML
→ Extracts theme palette from the first page and standardizes all HTML
→ Edge/Chrome computes final browser layout
→ Generates 16:9 editable PPTX
All shapes and text in the output PPTX are fully editable. The conversion preserves element positions, sizes, and overall proportions as computed by the browser. Complex CSS effects (shadows, gradients) are simplified. If the rendered HTML is not 16:9, content is scaled and centered with remaining area left blank.
- Multi-model support: Switch between MiMo and Gemini via
config.json - Theme standardization: Extracts a color palette from the first slide and applies it to all pages
- Speaker notes: Optionally read same-name
.txtfiles as context for the model - Grid alignment: All element coordinates snap to an 8px grid; same-row/column elements are force-aligned
- Mixed corner radii: Supports per-corner border-radius (SVG fallback for asymmetric corners)
- Emoji rendering: Emoji characters are rendered as images for consistent cross-platform display
- PPTX merge: Multiple single-slide PPTX files are automatically merged into one
Windows only. Ensure the following are installed:
- Python 3.10+
- Node.js 18+ with
npm - Microsoft Edge or Google Chrome
- Microsoft PowerPoint (optional, for manual inspection)
- Network access to the AI model API with a valid API key
python --version
node --version
npm --versionai-image2academic-ppt/
├─ input/ Place input images and optional TXT notes here
├─ output/ Generated PPTX and HTML files
├─ cache/ Intermediate artifacts (API JSON, theme palette)
├─ config.example.json Configuration template (no real keys)
├─ config.json Local config with API keys (git-ignored)
├─ install_dependencies.bat Install all dependencies
└─ batch_convert.bat Batch-convert all images in input/
Double-click install_dependencies.bat, or run manually:
python -m pip install -r requirements.txt
npm installPython dependencies: openai, Pillow, beautifulsoup4.
Node.js dependency: pptxgenjs.
Copy config.example.json to config.json and fill in your API key:
{
"models": {
"mimo": {
"api_key": "YOUR_MIMO_API_KEY",
"base_url": "https://api.xiaomimimo.com/v1",
"model": "mimo-v2.5",
"temperature": 0.1,
"timeout_seconds": 180,
"max_retries": 2,
"max_tokens": 16384
},
"gemini": {
"api_key": "YOUR_GEMINI_API_KEY",
"base_url": "https://your-gemini-endpoint/v1",
"model": "gemini-3.5-flash",
"temperature": 0.1,
"timeout_seconds": 180,
"max_retries": 2,
"max_tokens": 16384,
"thinking_level": "high"
}
},
"active_model": "mimo",
"conversion": {
"html_width": 1920,
"grid_size": 8,
"standardize_theme": true
}
}| Field | Description |
|---|---|
models.<name>.api_key |
Required. API key for the model |
models.<name>.base_url |
API endpoint URL |
models.<name>.model |
Model identifier |
models.<name>.timeout_seconds |
Per-request timeout |
models.<name>.max_retries |
Max retry count on failure |
models.<name>.thinking_level |
(Gemini only) Thinking depth |
active_model |
Which model to use ("mimo" or "gemini") |
conversion.html_width |
Base width of generated HTML |
conversion.grid_size |
Grid snap size in pixels |
conversion.standardize_theme |
Enable theme color standardization |
- Place screenshots in
input/(.png,.jpg,.jpeg,.webp,.bmp) - Optionally add same-name
.txtspeaker notes (e.g.,page1.png+page1.txt) - Double-click
batch_convert.bat - Check results in
output/
# Single file
python convert_slide.py page1.png --pptx
# Batch (all images in input/)
python convert_slide.py --pptx
# Disable theme standardization
python convert_slide.py --pptx --no-themeoutput/page2.html HTML layout (open in browser to inspect)
output/page2.pptx Editable PowerPoint file
cache/page2_mimo_blocks.json Layout blocks from the model
cache/theme_palette.json Extracted theme color palette
| Problem | Solution |
|---|---|
config.json not found |
Copy config.example.json to config.json and set your API key |
| API key not set | Check models.<active_model>.api_key in config.json |
python/node/npm not recognized |
Reinstall and add to system PATH |
| PPTX fails but HTML is OK | Ensure Edge or Chrome is installed; rerun install_dependencies.bat |
| TXT not read | Ensure TXT and image are in the same directory with identical base names |
ai-image2academic-ppt 将幻灯片截图和可选讲稿转换为可编辑 PowerPoint 文件。
目前许多 AI 工具可以直接生成学术风格的 PPT 图片,排版效果往往不错(我们导师也认可并推荐使用 GPT 生成此类图片),但生成的文字内容难免存在错漏,且缺乏便捷的修改手段。本项目的核心目标就是将这类 AI 生成的学术 PPT 图片还原为可编辑的 PPTX 文件,让你能够直接修正文本和布局。
使用方式:提供 AI 生成的 PPT 图片(可附上生图提示词或 PPT 提纲作为上下文),并配置一个支持图片识别的多模态大模型 API:
| 模型 | 特点 | 单页成本 |
|---|---|---|
| Gemini | 更好地遵循原图布局,后续改动少 | ~¥1/页 |
| MiMo | 赠金充足、Token 便宜,近乎免费 | ~¥0.01/页 |
以上价格为少量图片测试的粗略估算,仅供参考。
本项目使用 Codex 和 MiMoCode 共同开发,其中 MiMoCode 的 Compose 模式虽然执行缓慢,但效果意外不错。
| 输入(AI 生成的 PPT 图片) | 输出(可编辑 PPTX) |
|---|---|
![]() |
![]() |
PNG/JPG 截图 + 可选同名 TXT 讲稿
→ 多模态模型分析版面并生成 HTML
→ 从第一页提取主题色阶并标准化全部 HTML
→ Edge/Chrome 计算网页最终布局
→ 生成 16:9 可编辑 PPTX
生成的 PPTX 中图形和文字均可编辑。转换优先保持浏览器计算出的元素位置、宽高和整体比例;阴影、渐变等复杂网页效果会适当简化。若原网页不是 16:9,内容会等比缩放并居中,剩余区域留白。
- 多模型支持:通过
config.json切换 MiMo / Gemini - 主题色标准化:从第一页提取色阶,统一所有页面配色
- 讲稿辅助:可选读取同名
.txt文件作为模型参考 - 网格对齐:所有坐标吸附 8px 网格,同行/同列强制对齐
- 混合圆角:支持四角独立 border-radius(不对称圆角用 SVG 回退)
- Emoji 渲染:Emoji 字符渲染为图片,保证跨平台一致显示
- PPTX 合并:多页单张 PPTX 自动合并为一个文件
仅支持 Windows。安装前确认系统具备:
- Python 3.10 或更高版本
- Node.js 18 或更高版本,包含
npm - Microsoft Edge 或 Google Chrome
- Microsoft PowerPoint(仅用于人工检查,转换本身不强制依赖)
- 可访问模型 API 的网络环境和有效 API Key
python --version
node --version
npm --versionai-image2academic-ppt/
├─ input/ 输入图片和可选 TXT 讲稿
├─ output/ 最终 PPTX 和用于检查的 HTML
├─ cache/ API 版面 JSON 等中间产物
├─ config.example.json 不包含真实密钥的配置示例
├─ config.json 本机实际配置(已加入 .gitignore)
├─ install_dependencies.bat 安装项目依赖
└─ batch_convert.bat 批量转换 input 中的图片
双击 install_dependencies.bat,或手动执行:
python -m pip install -r requirements.txt
npm installPython 依赖:openai、Pillow、beautifulsoup4。
Node.js 依赖:pptxgenjs。
复制 config.example.json 为 config.json,填入真实 API Key:
{
"models": {
"mimo": {
"api_key": "你的 MiMo API Key",
"base_url": "https://api.xiaomimimo.com/v1",
"model": "mimo-v2.5",
"temperature": 0.1,
"timeout_seconds": 180,
"max_retries": 2,
"max_tokens": 16384
},
"gemini": {
"api_key": "你的 Gemini API Key",
"base_url": "https://your-gemini-endpoint/v1",
"model": "gemini-3.5-flash",
"temperature": 0.1,
"timeout_seconds": 180,
"max_retries": 2,
"max_tokens": 16384,
"thinking_level": "high"
}
},
"active_model": "mimo",
"conversion": {
"html_width": 1920,
"grid_size": 8,
"standardize_theme": true
}
}| 字段 | 说明 |
|---|---|
models.<名称>.api_key |
必填,模型 API 密钥 |
models.<名称>.base_url |
API 地址 |
models.<名称>.model |
模型标识 |
models.<名称>.timeout_seconds |
单次请求超时时间 |
models.<名称>.max_retries |
API 失败后的最大重试次数 |
models.<名称>.thinking_level |
(仅 Gemini)思考深度 |
active_model |
使用哪个模型("mimo" 或 "gemini") |
conversion.html_width |
生成 HTML 的基准宽度 |
conversion.grid_size |
元素坐标吸附网格大小(像素) |
conversion.standardize_theme |
是否启用主题色标准化 |
- 将截图放入
input/(支持.png、.jpg、.jpeg、.webp、.bmp) - 可选放入同名
.txt讲稿(如page1.png+page1.txt) - 双击
batch_convert.bat - 在
output/中查看结果
# 单张转换
python convert_slide.py page1.png --pptx
# 批量转换 input/ 下所有图片
python convert_slide.py --pptx
# 禁用主题色标准化
python convert_slide.py --pptx --no-themeoutput/page2.html HTML 布局(浏览器打开检查)
output/page2.pptx 可编辑 PowerPoint 文件
cache/page2_mimo_blocks.json 模型识别的版面区块
cache/theme_palette.json 提取的主题色阶
| 问题 | 解决方法 |
|---|---|
提示缺少 config.json |
复制 config.example.json 为 config.json,填入 API Key |
| 提示 API Key 未填写 | 检查 config.json 中 models.<active_model>.api_key |
python/node/npm 不是内部命令 |
重新安装对应程序,并加入系统 PATH |
| PPTX 生成失败但 HTML 已生成 | 确认已安装 Edge 或 Chrome,重新运行 install_dependencies.bat |
| TXT 没有被读取 | 确认 TXT 与图片位于同一目录、文件名完全一致,仅扩展名不同 |
MIT
如有问题或建议,欢迎通过邮箱联系:taolibupt@qq.com

