
Paper Deck
- 583 installs
- 971 repo stars
- Updated May 29, 2026
- zsyggg/paper-craft-skills
Builds high-fidelity AIGC slide decks from papers or articles by writing per-slide narrative direction, generating 16:9 slide images, then compiling to PPTX/PDF.
About
A raster-first slide generator that turns a paper or article into a designed-looking deck by directing each page's narrative and calling an image model to render every 16:9 slide before compiling to PPTX/PDF. A developer uses it for reading-group, defense, or tech-share decks that should not look like template slides.
- Raster-first: each slide is a generated image, not template shapes; stops if no image backend exists
- Produces a deck brief and per-page prompts as re-editable source files
Paper Deck by the numbers
- 583 all-time installs (skills.sh)
- Ranked #375 of 1,335 Generative Media skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/zsyggg/paper-craft-skills --skill paper-deckAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 583 |
|---|---|
| repo stars | ★ 971 |
| Last updated | May 29, 2026 |
| Repository | zsyggg/paper-craft-skills ↗ |
What it does
Builds high-fidelity AIGC slide decks from papers or articles by writing per-slide narrative direction, generating 16:9 slide images, then compiling to PPTX/PDF.
Files
Paper Deck — Visual Slide Director
把论文/知识内容做成看起来真的被设计过的幻灯片。
核心路线不是用 PPT 对象硬摆版式,而是:
1. 先理解内容,做出 deck brief 和逐页叙事。 2. 为每一页写清楚“这页要让观众看到什么、感到什么、记住什么”。 3. 用生图模型生成 16:9 slide image。 4. 合成 PPTX/PDF,并保留 prompts 作为可返修的源文件。
不可绕过的生图要求
Paper Deck 的 V1 是 raster-first AIGC slide image 工作流。除非用户明确要求“不要生图”“用代码画图”“只要可编辑 PPT”或“使用 HTML/SVG/Canvas 生成”,否则必须调用真实的 raster image generation backend 为每一页生成图片。
严格禁止把以下产物冒充为本 skill 的“生图页”:
- 用 Python/Pillow、SVG、HTML/CSS、Canvas、Mermaid、matplotlib、PPT shapes 或任何本地绘图代码直接画出的整页图片
- 用模板、纯排版脚本、截图、占位图或手工组合元素替代生图后端输出
- 先本地画整页,再仅做轻微滤镜/后处理后当作 AIGC slide image
允许的本地处理仅限:
- 移动、复制、重命名生图后端输出文件
- 必要的格式转换、压缩、尺寸校验、PPTX/PDF 合成
- 用户明确选择混合方案时,在生图背景上叠加少量可编辑文字层;此时必须在
deck-brief.md和交付说明中明确记录“混合文字层”,不能声称整页文字都由生图模型完成
如果当前环境没有可用的 raster image generation backend,必须停止并说明缺少生图后端;不要退化成本地绘图替代方案。
何时使用
适合:
- 论文组会、答辩、reading group、技术分享
- 需要“一眼不像模板 PPT”的视觉汇报
- 用户愿意接受每页是高质感图片,优先追求整体观感和传播效果
- 需要逐页返修:重做第 N 页、换风格、加真实感、减少 AI 味
不适合:
- 需要多人在 PowerPoint 里精细编辑每个文本框
- 大量表格、财务报表、合规材料
- 需要准确复制已有企业 PPT 母版
如果用户需要完全可编辑的 PPT,说明本 skill 的 V1 是 raster-first;可改用常规 PPTX 工具,或生成“图片背景 + 可编辑文字层”的混合方案。
工作流
Step 1: 输入分析
接受:
- arXiv / DOI / 网页链接
- PDF 路径
- Markdown / 文本 / 文章
- 已有大纲
- 参考图片或参考 PPT 截图
如果是论文,优先复用 paper-analyzer 的阅读方式:读摘要、方法、实验、图表、结论;必要时搜索代码仓库。目标不是写长文,而是提取适合做 slide 的核心叙事。
输出并保存 analysis.md:
- 主题、受众、汇报场景
- 论文/内容的 1 句话主张
- 3-5 个必须讲清楚的核心点
- 推荐页数、推荐风格、语言
- 需要生成的图像类型:封面、机制图、流程图、数据页、结论页等
- 可直接使用的真实素材:论文 Figure/Table、PDF 截图、用户提供的截图、代码截图、实验曲线
Step 2: 生成前确认
默认必须确认,不要直接生成图片。除非用户明确说“直接生成/不用确认/按默认来”。
询问时控制在 3 个问题以内:
1. 页数和用途:组会 / 答辩 / 公开分享 / 商业汇报,需要几页? 2. 风格:见 references/style-system.md。 3. 是否插入真实素材:是否允许从 PDF/论文图表中截图,或由用户提供截图/图片?如果允许,说明预计第几页使用哪些真实素材。
推荐话术:
我建议做 12 页,风格用 journal-minimal:像 Nature/IEEE 论文图 + 正式学术汇报,清晰、克制、不花哨。
也可以换成 business-research 做商业研究分享,warm-notes 做手记风,或 liquid-glass 做 Apple 式玻璃质感。
这篇论文我建议在第 4 页插入原论文方法图局部截图,第 8 页插入实验曲线/表格截图,再基于这些真实素材做设计化排版。
确认后我会先生成 outline.md 和每页 prompt,再逐页出图并合成 PPTX/PDF。Step 3: Deck Brief
保存 deck-brief.md。必须包含:
style_presetaudienceslide_countlanguagevisual_rulesdo_not_usereference_images(如有)source_visual_plan:哪些页使用真实图表/截图,来源和处理方式
风格细节按需读取 references/style-system.md。 真实素材策略按需读取 references/source-visuals.md。
Step 4: Outline
保存 outline.md。每页用固定结构:
## 01. Slide Title
- Role: cover / context / method / mechanism / evidence / result / takeaway
- Message: 这一页唯一要讲清楚的观点
- Visual: 画面主视觉和构图
- Text: 页面上允许出现的短文字
- Evidence: 引用的论文图表/公式/实验数据/代码位置
- Source visual: 是否使用真实截图/论文图表;来源、裁剪范围和落位
- Repair handle: 后续返修时可引用的定位描述规则:
- 每页只承载一个主观点。
- 页面文字尽量少;复杂解释放 speaker script 或备注里。
- 机制页优先画“输入 → 处理 → 输出”,不要画抽象灵感。
- 数据页只放最有说服力的 1-3 个数字。
- 真实论文图/截图通常比凭空生成更可信;能用真实素材时优先规划真实素材落位。
- 不要过度留白。主视觉、图表或证据区域通常应占画面 60%-80%,除非是封面或章节页。
- 8 页以上必须有节奏变化:封面、问题、方法、机制、证据、结论交替。
Step 5: Prompt Files
每页必须先写 prompt 文件,再调用任何生图工具。
路径:
paper-deck/{topic-slug}/
├── analysis.md
├── deck-brief.md
├── outline.md
├── prompts/
│ ├── 01-slide-cover.md
│ ├── 02-slide-context.md
│ └── ...
├── images/
│ ├── 01-slide-cover.png
│ ├── 02-slide-context.png
│ └── ...
├── {topic-slug}.pptx
└── {topic-slug}.pdfPrompt 写法读取 references/prompt-template.md。
硬规则:
- prompt 必须明确 16:9。
- prompt 里要写清楚风格、构图、文字语言、文字数量限制。
- 不要让模型生成页码、logo、水印、PPT 外壳。
- 如果需要精准文字,尽量减少图片内文字;可以后续做混合文字层。
- 如果本页使用真实素材,prompt 必须说明素材如何作为画面的一部分:嵌入、裁切、玻璃面板承载、旁注、放大框,而不是让模型凭空重画事实。
Step 6: 生成图片
图片后端选择:
1. Codex 环境优先用内置 imagegen。 2. 如果用户指定 baoyu-imagine、Gemini、OpenAI、Seedream 等后端,按用户指定。 3. 如果没有可用生图后端,停止并告诉用户需要一个 raster image backend。
生图门禁:
- 在调用任何生图工具之前,必须已经写好对应页的
prompts/NN-*.md。 - 每一页最终进入
images/的主图必须来自真实 raster image generation backend。 - 不允许用 Python/Pillow、SVG、HTML/CSS、Canvas、Mermaid、matplotlib、PPT shapes 或本地绘图脚本生成整页主图来替代生图。
- 不允许因为担心中文文字错误,就绕过生图后端改成本地绘制整页。正确做法是减少图片内文字、改 prompt 重生成,或在用户同意的情况下使用“生图背景 + 可编辑文字层”的混合方案。
- 如果使用混合文字层,
images/中仍必须保留每页的生图背景或生图整页来源,并在deck-brief.md记录哪些文字是后叠加的。 - 生成后要在
generation-log.md记录每页使用的后端、prompt 文件、输出文件、生成时间;没有生成记录的图片不能作为最终交付页。
生成策略:
- 先生成第 1 页作为风格锚点。
- 后续页如果后端支持 reference image,就用第 1 页作为风格参考,降低漂移。
- 每 3-4 页检查一次缩略图,发现风格漂移就修 prompt 再继续。
- 保存失败页,不要覆盖成功页。
Step 7: 合成 PPTX/PDF
生成完图片后运行:
python3 <SKILL_ROOT>/scripts/merge_deck.py paper-deck/{topic-slug}脚本会读取 images/NN-*.png|jpg|webp,输出同名 .pptx 和 .pdf。每张图片铺满一页 16:9。
Step 8: 质量检查
交付前按 references/quality-gate.md 检查:
- 是否一眼像真实设计作品,而不是模板堆砌
- 每页是否只有一个主观点
- 是否有过多无意义留白;关键内容是否占据足够画面
- 真实素材页是否明确记录来源、页码/图号和落位
- 风格是否一致
- 图片文字是否清晰、无错别字、无伪字
- 是否存在 AI 常见问题:假 UI、假 logo、乱码标签、过度赛博、塑料 3D、无意义装饰
generation-log.md是否存在,且每一页都记录了真实 raster image generation backend、prompt 文件和输出文件- 是否存在本地绘图/模板/截图冒充生图页;如有,必须重做或明确改成用户确认过的非 paper-deck 路线
- PPTX/PDF 是否能打开,页数是否正确
Step 9: 返修
返修时永远先改源文件:
| 用户说 | 操作 |
|---|---|
| “第 5 页更学术一点” | 改 prompts/05-*.md,保留旧图,生成新图 |
| “统一成第 1 页的质感” | 把第 1 页风格锚点追加到相关 prompts |
| “第 7 页文字太多” | 修改 outline 的 Text,再改 prompt |
| “只重做背景,不动内容” | 在 prompt 中保留 Message/Text,重写 Visual |
| “新增一页机制细节” | 更新 outline,新增 prompt,生成图片,重跑合成脚本 |
不要用程序在生成图上涂改文字。文字错了就改 prompt 重生成,或切换到混合文字层方案。
参考文件
references/style-system.md:风格预设和选择规则references/layouts.md:常用页面角色与构图references/source-visuals.md:PDF 截图、论文图表、用户图片的使用策略references/prompt-template.md:逐页生图 prompt 模板references/quality-gate.md:交付前检查和返修标准
Layouts
这些不是固定模板,而是逐页生图时的构图角色。先选页面角色,再写 prompt。
Slide Roles
| Role | 用途 | 构图 |
|---|---|---|
cover | 封面,一眼说明主题和气质 | 大标题 + 视觉锚点 + 少量元信息 |
problem | 为什么这个问题重要 | 左侧问题/右侧现实场景或证据 |
context | 背景和已有方法 | 时间线 / 方法地图 / 层级图 |
method-overview | 方法总览 | 输入 → 核心模块 → 输出 |
mechanism-detail | 单个核心机制拆解 | 局部放大、编号步骤、短标签 |
comparison | 新旧方法/ablation 对比 | 左右对照、差异高亮 |
evidence | 实验或数据证据 | 大数字 + 小图表 + 解释标签 |
paper-figure-remix | 重画论文 Figure | 保留事实,重新组织视觉层级 |
code-link | 方法与代码对应 | 文件/函数/流程的关系图 |
takeaway | 结论和下一步 | 1 句结论 + 3 个要点 |
Rhythm
8-12 页推荐节奏:
cover → problem → context → method-overview → mechanism-detail → mechanism-detail → evidence → comparison → limitation → takeaway12-18 页推荐节奏:
cover
problem / context
method-overview
3-5 pages mechanism-detail
2-4 pages evidence / comparison
limitation
takeaway / discussionComposition Rules
- Cover: 文字少,主视觉强。
- Method overview: 中间主图必须占 65%-80% 画面。
- Mechanism detail: 每页只拆一个机制,避免把整篇论文塞进一页。
- Evidence: 数字要大,解释要短;不要生成密密麻麻的表格。
- Comparison: 左右结构必须对称,差异点要显眼。
- Takeaway: 不要再引入新概念。
- 不要过度留白。留白要服务层级和呼吸感,不能让页面像没做完。
- 如果用户允许使用真实素材,优先给论文图、表格、实验曲线、PDF 截图规划明确落位。
Text Limits
| 页面类型 | 图片内文字建议 |
|---|---|
| cover | 标题 1 行,副标题 1 行,元信息 1 行 |
| method-overview | 5-9 个短标签 |
| mechanism-detail | 6-12 个短标签 |
| evidence | 1 个大数字 + 2-4 个短解释 |
| takeaway | 1 句主结论 + 3 个短点 |
如果文字超过限制,优先拆页或改成可编辑文字层,不要强行让生图模型写长段落。
Prompt Template
每页 prompt 先保存为 prompts/NN-slide-{slug}.md,再调用生图模型。
Template
---
slide: NN
title: "Slide title"
role: "cover | problem | method-overview | mechanism-detail | evidence | takeaway"
style_preset: "journal-minimal"
language: "zh"
aspect_ratio: "16:9"
output: "images/NN-slide-slug.png"
---
Create one complete 16:9 presentation slide image.
Purpose:
[This slide's single message.]
Style:
[Use the selected preset phrase from style-system.md.]
Composition:
[Describe the layout spatially: left/right/top/bottom/center, main visual size, hierarchy.]
Content:
- [Short label or title text that may appear on the slide]
- [Diagram elements and their relationships]
- [Data/evidence if needed]
Visual Details:
- [Color, line, texture, typography, background]
- [How to render diagrams, arrows, cards, figure callouts]
Constraints:
- The output must be a polished 16:9 slide, not a poster mockup.
- Keep all text short and readable.
- Do not generate page numbers, logos, watermarks, signatures, browser chrome, app chrome, or decorative borders.
- Do not use fake brand logos, fake UI details, meaningless microtext, plastic 3D, generic AI robot imagery, neon cyberpunk effects, gradient blobs, or stock-template decorations.
- Keep enough whitespace for hierarchy, but do not leave the slide feeling empty; the main visual/evidence area should usually occupy 60-80% of the slide.With Source Visuals
When using real screenshots, paper figures, tables, plots, or user-provided images, add this block:
Source Visual:
- Use source image: [path or figure/table/page number]
- Crop/focus: [exact region or semantic target]
- Placement: [left/right/center/full-width panel]
- Treatment: [clean frame / glass panel / figure callout / side annotation / zoom inset]
- Fidelity: preserve the real visual content; do not invent new labels, fake UI, fake plots, or fake numbersChinese Slide Text
中文页尽量让图片内文字短:
- 标题不超过 16 个汉字。
- 标签不超过 8 个汉字。
- 不要让模型写长句、段落、公式推导。
- 复杂文字放到备注或后续可编辑文字层。
Paper Figure Remix
如果重画论文图:
- 不要照抄原图布局。
- 保留事实关系:模块名、输入输出、关键公式、实验结论。
- 改善视觉层级:先让观众看懂主流程,再看细节。
- 标注来源:在 outline 的 Evidence 中写 Figure/Table 编号;不要把长引用塞进图里。
Repair Prompt Pattern
返修第 N 页时,在原 prompt 末尾追加:
Revision request:
[User's requested change.]
Keep:
[Elements that must stay the same.]
Change:
[Elements that should change.]
Avoid:
[Problems observed in previous image.]不要只写“更高级一点”。要翻译成具体视觉修改:减少装饰、控制留白、改成白底、换成真实论文图截图、缩短标签、放大主流程等。
Quality Gate
交付前检查这些项。任何一项明显失败,都先返修。
Visual Reality
- 是否像真实设计师做过,而不是模板拼贴?
- 是否避免了常见 AI 味:乱码、小字胡乱堆叠、假 logo、假 UI、塑料质感、过度赛博、无意义装饰?
- 是否有明确留白和视觉焦点,但没有大面积无意义空白?
- 主视觉/图表/证据区域是否通常占据 60%-80% 画面?
- 每页是否只有一个主观点?
Consistency
- 是否所有页面使用同一个 style preset?
- 强调色是否统一?
- 字体气质是否统一?
- 图表线条、箭头、模块、标签密度是否大体一致?
- 是否出现某几页突然变成完全不同画风?
Content Accuracy
- 论文贡献是否讲对?
- 方法流程是否符合论文?
- 实验数字、模型名、数据集名是否准确?
- 公式或变量是否没有乱写?
- 如果引用代码,路径/函数是否真实存在?
- 如果使用 PDF 截图或论文图表,是否记录了来源页码/图号/裁剪范围?
Text
- 图片内文字是否可读?
- 是否有错别字、伪字、乱码?
- 中文是否自然,不像机器翻译?
- 文字太多时,优先拆页或改为混合文字层。
Delivery
outline.md存在。- 每页 prompt 文件存在。
images/中图片数量和 outline 页数一致。- PPTX 能打开,页数正确。
- PDF 能打开,页数正确。
- 返修过的旧图没有被无记录覆盖。
Source Visuals
真实素材能显著降低“AI 一眼假”。如果用户给了 PDF、论文图、截图、旧 PPT、产品界面或实验结果,先规划能否直接使用这些素材,而不是全部凭空生成。
Initial Question
在确认阶段问清楚:
是否允许我从 PDF/论文图表里截取真实图,或使用你提供的截图/图片?如果允许,我会在 outline 里标明第几页使用哪张真实素材,以及是原样嵌入、局部裁切、重新排版还是作为参考重绘。Priority
优先使用:
1. 论文原始 Figure:方法图、架构图、流程图、主结果图。 2. 实验曲线和表格:关键 benchmark、ablation、对比结果。 3. 用户真实截图:产品界面、代码、dashboard、实验记录。 4. 代码仓库截图:README 图、模型结构、运行结果。
不优先使用:
- 分辨率太低、压缩严重、文字糊的图片。
- 密密麻麻、讲不清主观点的大表。
- 有敏感信息的截图,除非用户明确允许并先脱敏。
Placement Patterns
| Pattern | 用途 |
|---|---|
hero-crop | 封面或章节页,把真实图局部放大做视觉锚点 |
figure-remix | 保留真实图核心结构,旁边加解释和局部放大 |
evidence-panel | 左侧结论,右侧真实表格/曲线截图 |
zoom-inset | 原图 + 关键区域放大框 |
glass-mounted | 在 liquid-glass 风格中,把真实截图放进玻璃面板 |
paper-strip | 一排真实图小片段,形成证据墙 |
Outline Requirement
每页如果使用真实素材,必须在 outline 写:
- Source visual: Figure 2 from PDF page 5, crop center architecture, place as 70% width main panel, add three calloutsPrompt Requirement
每页 prompt 必须写清楚:
- 使用哪个源文件或图号。
- 保留真实内容,不发明新数字、新标签、新 UI。
- 只是进行裁切、边框、玻璃面板、旁注、局部放大、背景统一。
When To Ask User For Files
如果 PDF 里没有足够好的图,但页面需要真实截图,直接告诉用户:
第 6 页最好放真实产品/实验截图,这比生图模型凭空画更可信。你可以提供截图;如果没有,我会改成抽象机制图。Style System
Paper Deck 的风格不是“换配色”,而是一整套视觉导演规则:字体气质、构图密度、图像真实感、图表语言、留白、页面节奏必须一致。
Presets
| Preset | 适合 | 视觉锚点 |
|---|---|---|
journal-minimal | 内部讨论、组会、论文答辩、公开学术汇报 | Nature/IEEE-inspired 论文图风格,简明、清晰、投稿级配色 |
business-research | 商业化研究、行业报告、投资汇报、客户分享 | 高级研究 briefing,结构化标题、数据证据、杂志式商业质感 |
warm-notes | 知识课、科普、论文学习笔记、教育内容 | 温暖手记风,明亮纸感、手绘注释、柔和高亮 |
liquid-glass | AI 产品、工程系统、视觉章节页、高级发布感内容 | Apple-inspired 透明玻璃质地,丰富柔和色彩、半透明层次、高级流光 |
Default Recommendation
- 论文组会 / 答辩 / 技术公开分享:优先
journal-minimal - 商业研究 / 行业趋势 / 投资人或客户分享:优先
business-research - 教程 / 科普 / 学习笔记 / 知识内容:优先
warm-notes - AI 产品 / 工程系统 / 高级视觉章节页:优先
liquid-glass
Preset Details
journal-minimal
目标:简约但不简陋,像 Nature / IEEE 论文图、投稿图和正式学术汇报的结合。它可以用于内部讨论,也可以直接拿去答辩或公开汇报。
- Background: white / near-white / very light cool gray, with subtle panel separation only when needed
- Color: black, cool gray, one clear scientific accent (Nature blue, teal, muted red, or IEEE blue)
- Typography: clean sans-serif, compact labels, figure-caption discipline
- Visuals: publication-style method figure, pipeline, matrix blocks, equation callouts, small data inset, real paper figure crop when useful
- Layout: dense enough to feel useful; main diagram should occupy 65-80% of the slide, not float in excessive whitespace
- Feel: submission-quality clarity, credible, direct, no decoration for decoration's sake
- Avoid: cartoon, heavy texture, fake 3D, glossy SaaS illustration, decorative stickers, giant empty hero whitespace
- Text density: medium; title + 3-8 short labels
Prompt phrase:
Nature / IEEE-inspired minimal academic presentation slide, publication-quality scientific figure aesthetic, clean white or light gray background, precise method diagram, clear restrained scientific color palette, compact readable labels, credible paper submission visual stylebusiness-research
目标:商业化研究分享能用,结构强,有数据证据,也有高级传播感。
- Background: white / pale gray / subtle grid
- Color: charcoal + navy/teal/gold single accent, occasional full-bleed editorial photo if needed
- Typography: executive briefing, compact but clean; large section titles and small source notes
- Visuals: 2x2, timeline, evidence wall, market map, metric callout, before/after, strategic thesis
- Feel: premium consulting research + serious magazine feature
- Avoid: colorful startup gradients, decorative blobs, fake dashboards, random business stock photos
- Text density: medium
Prompt phrase:
premium business research presentation slide, structured evidence layout, consulting-grade clarity, restrained color, elegant editorial data visualization, credible strategic briefing aestheticwarm-notes
目标:亲和、有手作感,但不是幼稚。
- Background: warm cream paper, clean and bright
- Color: ink black + soft blue/coral/olive/yellow
- Typography: clear handwritten-style labels, readable
- Visuals: sketchnote, flow, analogy, small helpful icons
- Avoid: old parchment, dirty texture, childish cartoon
- Text density: medium
Prompt phrase:
warm research notebook slide, clean cream paper, hand-drawn but precise, soft highlighter colors, readable handwritten-style labels, thoughtful educational design, polished human study notesliquid-glass
目标:舍弃普通科技风,改成更有辨识度的透明玻璃质地。参考 Apple 式 Liquid Glass / translucent material 的高级感:不是全透明,也不是廉价赛博,而是有折射、柔和色彩和层次的玻璃版式。
- Background: soft luminous gradient field or deep blurred color field; no flat empty black screen
- Color: richer but controlled palette: icy blue, violet, cyan, soft magenta, pearl white, translucent charcoal
- Typography: Apple-like clean sans-serif, large calm title, minimal body
- Visuals: frosted glass panels, translucent cards, subtle refraction, soft highlights, layered depth, precise figure fragments under glass
- Layout: 2-4 meaningful glass layers; avoid one giant empty glass rectangle
- Feel: premium Apple keynote material study, colorful but elegant, tactile, high-end visual chapter page
- Avoid: cheap neon cyberpunk, excessive glow, random 3D objects, plastic buttons, SaaS dashboard pile, fake robot cliches, unreadable low contrast
- Text density: low-medium; best for cover, section divider, conceptual overview, not dense method proof
Prompt phrase:
Apple-inspired liquid glass presentation slide, premium translucent frosted glass material, soft colorful refraction, layered depth, pearl white and icy blue violet highlights, clean Apple keynote typography, elegant high-end visual design, not cyberpunkConsistency Rules
- 一份 deck 只选一个 preset。
- 一个 preset 只允许 1-2 个强调色。
- 封面图可以更有冲击力,机制页必须更清楚。
journal-minimal不追求炫,追求论文图一样的清楚。liquid-glass不追求科技模板,追求真实玻璃材质和高级色彩。- 如果用户提供参考图,先提取可复用的设计语言,不要照抄具体作品。
#!/usr/bin/env python3
"""Merge generated slide images into PPTX and PDF.
Usage:
python3 merge_deck.py /path/to/paper-deck/topic-slug
"""
from __future__ import annotations
import argparse
import re
from pathlib import Path
from PIL import Image
from pptx import Presentation
from pptx.util import Inches
IMAGE_EXTS = {".png", ".jpg", ".jpeg", ".webp"}
SLIDE_W_IN = 13.333333
SLIDE_H_IN = 7.5
def natural_key(path: Path) -> tuple[int, str]:
match = re.match(r"^(\d+)", path.stem)
number = int(match.group(1)) if match else 9999
return number, path.name
def find_images(deck_dir: Path) -> list[Path]:
image_dir = deck_dir / "images"
if not image_dir.exists():
raise SystemExit(f"Missing images directory: {image_dir}")
images = [p for p in image_dir.iterdir() if p.suffix.lower() in IMAGE_EXTS]
images.sort(key=natural_key)
if not images:
raise SystemExit(f"No slide images found in: {image_dir}")
return images
def make_pptx(images: list[Path], output: Path) -> None:
prs = Presentation()
prs.slide_width = Inches(SLIDE_W_IN)
prs.slide_height = Inches(SLIDE_H_IN)
blank = prs.slide_layouts[6]
for image in images:
slide = prs.slides.add_slide(blank)
slide.shapes.add_picture(
str(image),
0,
0,
width=prs.slide_width,
height=prs.slide_height,
)
prs.save(output)
def make_pdf(images: list[Path], output: Path) -> None:
frames: list[Image.Image] = []
for image_path in images:
with Image.open(image_path) as img:
rgb = img.convert("RGB")
frames.append(rgb.copy())
first, *rest = frames
first.save(output, save_all=True, append_images=rest, resolution=150.0)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("deck_dir", help="Deck directory containing images/")
parser.add_argument("--name", help="Output base name. Defaults to deck directory name.")
args = parser.parse_args()
deck_dir = Path(args.deck_dir).expanduser().resolve()
if not deck_dir.exists():
raise SystemExit(f"Deck directory does not exist: {deck_dir}")
images = find_images(deck_dir)
base = args.name or deck_dir.name
pptx_path = deck_dir / f"{base}.pptx"
pdf_path = deck_dir / f"{base}.pdf"
make_pptx(images, pptx_path)
make_pdf(images, pdf_path)
print(f"Merged {len(images)} slides")
print(f"PPTX: {pptx_path}")
print(f"PDF: {pdf_path}")
if __name__ == "__main__":
main()