Poem to Picturebook - 古诗绘本视频脚本与分镜插图生成
Overview
将一首古诗拆解为儿童绘本视频脚本。逐句分析古诗,为每句诗设计一个分镜场景,用儿童易懂的白话文讲述古诗内容,配合元素丰富、富有童趣的静态画面描述,最终编排为完整的绘本故事脚本。在脚本完成后,可继续进入阶段二:为每个分镜生成候选插图,经用户挑选与修改确认,产出最终分镜图片。最后进入阶段三:为每个分镜生成文字面板(古诗原文+白话文讲述),与阶段二的画面垂直拼接,组成完整的绘本分镜图。
三阶段流程:
1. 阶段一 — 脚本生成:拆解古诗为分镜脚本,保存到 IMA 知识库
2. 阶段二 — 图片生成:候选图生成 → 用户挑选 → 修改确认 → 最终底稿 → 保存到 IMA
3. 阶段三 — 文字面板与拼接:生成古诗原文+白话文的文字面板 → 与画面拼接 → 保存到 IMA
IMA 知识库统一存储路径:所有阶段的产出均保存到 IMA 知识库「个人知识库 → 绘本库 → 古诗绘本画面 → [古诗名称]」文件夹下。
核心叙事设计(旁白与画面双轨):
- 旁白(白话文讲述):保持小读者第一人称沉浸视角。想象一个孩子翻开了绘本,就这样走进古诗描绘的世界——"我"站在池塘边、坐在小船上、站在城楼上。"我"亲眼看见、亲耳听到、亲身感受诗中的一切。
- 画面:采用第三人称视角——绘本主角完整出现在画面中,亲身处于古诗描绘的画面和场景里,经历古诗描绘的故事。读者既能听到"我"的心声旁白,又能看到"我"在场景中的样子(奔跑、张望、触摸、惊叹),弥补第一人称画面缺少主角形象的不足。
When to Use
- 用户提供一首古诗,要求转化为绘本故事或视频脚本
- 用户要求将古诗"拆解为分镜""做成绘本""编排为故事"
- 用户提到"古诗 + 儿童/绘本/视频/分镜/白话文"的组合需求
- 用户已有分镜脚本(本技能产出或外部提供),要求"生成分镜图片""绘本插图""分镜配图"
IMA Knowledge Base Integration (IMA 知识库集成)
本技能的所有阶段产出(脚本、图片、拼接图)均需保存到用户的 IMA 知识库。保存前必须先加载 ima-skill 技能,按其 knowledge-base 模块的流程操作。
统一存储路径
IMA 知识库
└── 个人知识库
└── 绘本库 (knowledge base)
└── 古诗绘本画面 (folder)
└── [古诗名称] (folder,如"咏柳")
├── [古诗名称]-儿童绘本视频脚本.md ← 阶段一产出
├── S00_final.png ← 阶段二产出(最终底稿)
├── S01_final.png
├── ...
├── S00_text.png ← 阶段三产出(文字面板)
├── S01_text.png
├── ...
├── S00_combined.png ← 阶段三产出(拼接图)
├── S01_combined.png
└── ...
IMA 保存操作流程
每次需要保存文件到 IMA 时,执行以下步骤:
- 定位知识库:调用
search_knowledge_base(query: "绘本库")找到"绘本库"知识库,获取knowledge_base_id。 - 定位文件夹:调用
search_knowledge(query: "古诗绘本画面",knowledge_base_id: 上一步的 ID)找到"古诗绘本画面"文件夹,获取folder_id。 - 定位古诗子文件夹:在该文件夹下搜索以古诗名称命名的子文件夹(如"咏柳")。若不存在,请用户在 IMA 客户端中手动创建后告知,或直接上传到"古诗绘本画面"文件夹下。
- 上传文件:按 IMA skill 的文件上传流程(
check_repeated_names→create_media→ COS 上传 →add_knowledge),将folder_id设为古诗子文件夹的 ID。
- Markdown 文件:media_type=7
- PNG 图片:media_type=9 - 确认成功:上传成功后告知用户文件已保存到 IMA 知识库的对应路径。
> IMA 不可用时的降级:若 IMA(ima-mcp 连接器)未连接或上传失败,将文件保存到本地 output/<作品名>/ 目录,并告知用户手动上传。
Workflow — Stage 1: Script Generation (阶段一:脚本生成)
Step 1: Receive and Parse the Poem (接收与解析古诗)
- Confirm the poem title, author, and dynasty.
- Split the poem into individual lines (句). Each line becomes one storyboard scene.
- For multi-line couplets (联/绝句/律诗), treat each clause (逗号或句号分隔的片段) as a separate scene if the clause carries distinct imagery; otherwise treat the full line as one scene.
- Identify the poem's overall theme, mood, and narrative arc (起承转合).
Step 2: Design Storyboard Scenes (设计分镜)
For each poem line, design a storyboard scene containing the following fields:
| Field | Description |
|---|---|
| 分镜编号 | Sequential number (S01, S02, ...) |
| 原文 | The original poem line (verbatim) |
| 白话文讲述 | First-person immersive narration from the child reader's perspective ("我"). The child has stepped INTO the poem's world. Use "我" as the narrator: "我跑到池塘边""我抬头一看". The child sees, hears, touches, and feels everything firsthand. Simple, vivid, engaging language for ages 3-8. |
| 画面描述 | 第三人称视角的静态画面描述——为该分镜生成一张静态插图的完整画面内容:绘本主角完整入画,亲身处于古诗描绘的场景中,经历诗中故事。按五个维度组织:①主体——主角的姿态、动作、表情,画面其他核心元素及其数量、姿态、动作、细节特征;②场景——时间(清晨/正午/黄昏/夜晚)、天气(晴/多云/起风/小雨等);③构图——画面视角(平视/仰视/俯视/侧面)与景别(全景/中景/近景/特写);④艺术风格——儿童绘本绘画;⑤画质——4:3 比例,720P。内容元素尽量丰富、富有童趣,描述需具体到可被插画师或 AI 直接生成一张静态图片的程度。不包含任何镜头运动或声音设计。 |
| 预计时长 | Estimated duration in seconds (typically 8-15s per scene for children's content) |
Step 3: Add Story Framework (添加故事框架)
Wrap the scenes with a narrative structure built around the child's journey of entering and exiting the poem's world:
- 封面分镜 (Cover Scene - 进入故事): The child opens the picture book and is "pulled into" the poem's world. The narration establishes "我" as the one who steps into the scene. Visual: the protagonist fully visible, stepping from the real world into the poem's setting (e.g. 从翻开的书本旁走进池塘边场景的全身形象).
- 正文分镜 (Body Scenes - 沉浸在故事中): One scene per poem line (from Step 2). The protagonist is fully visible in every scene — walking, looking, touching, listening, experiencing the poem's story firsthand. The protagonist never leaves the scene.
- 结尾分镜 (Ending Scene - 离开故事): The protagonist waves goodbye to the poem's world and returns to reality. A warm closing that bridges back: "我合上绘本,心里还想着那片池塘..." reinforces that the child has lived through the story.
Step 4: Output the Script (输出脚本)
Produce the final script in two formats:
Format A: Markdown (readable script)
Use the template at assets/script_template.md. Copy it, fill in all fields, and present to the user.
Format B: JSON (structured data, optional)
Use the template at assets/script_template.json for structured output when the user needs machine-readable data for downstream tools (video editors, illustration pipelines, etc.).
For detailed guidance on static visual design, age-appropriate language, and pacing, refer to references/storyboard_guide.md.
Step 5: Save Script to IMA Knowledge Base (保存脚本到 IMA 知识库)
脚本生成后,自动将 Markdown 脚本文件上传到 IMA 知识库。
- 加载 IMA 技能:调用
ima-skill技能,按其 knowledge-base 模块流程操作。 - 定位存储路径:按上方「IMA 知识库集成」的流程,定位到「绘本库 → 古诗绘本画面 → [古诗名称]」文件夹。
- 上传脚本:将生成的 Markdown 脚本文件(如
咏柳-儿童绘本视频脚本.md)上传到该文件夹。 - 告知用户:上传成功后告知用户脚本已保存到 IMA 知识库。
> 若 IMA 不可用,将脚本保存到本地 output/<作品名>/ 目录,并告知用户手动上传。
Workflow — Stage 2: Storyboard Image Generation (阶段二:分镜图片生成)
When the script is confirmed (or the user directly provides a storyboard script), generate illustrations per scene. The process is: 风格设定 → 每分镜4张候选图 → 用户手动挑选 → 逐张询问修改意见 → 修改确认 → 最终底稿 → 保存到 IMA. Detailed prompt templates, ImageGen parameters, and naming conventions are in references/image_generation_guide.md — load it before generating any images.
Step 6: Build the Style Bible (建立风格设定卡)
Before generating any image, distill a unified style bible from the script and save it to output/<作品名>/style_bible.md. Every image prompt in Steps 7-8 must embed this bible verbatim as the prompt prefix. The bible contains:
- 整体画风: 固定为儿童绘画风格,默认描述为:"儿童手绘插画风格,粗犷的蜡笔/彩色铅笔笔触,大胆鲜艳的色块,黑色勾线轮廓,色彩饱满明亮,造型稚拙可爱,富有童趣,适合3-8岁儿童。" 除非用户明确要求更换画风,否则所有分镜统一使用此画风,不得擅自改为水彩、油画、写实等其他风格。Avoid vague words like "好看" — describe medium, brushwork, rendering, light concretely.
- 主色调: 3-5 colors with mood, consistent with the poem theme (see
references/storyboard_guide.md配色表). - 主角设定(绘本主角): complete full-body description — approximate age, gender, hairstyle, face, clothing color/style, shoes, body proportions. The protagonist is fully visible in every scene, so the bible must pin down the complete appearance so the character looks identical across scenes. 主角形象必须参考用户 IMA 知识库「个人知识库/绘本库/绘本主角形象」文件夹下的图片;若 IMA(ima-mcp 连接器)不可用,请用户连接后再生成,或让用户直接提供参考图,不得凭空想象主角形象。
- 核心角色与物品设定: concrete appearance for every recurring character/object (the goose's pose & proportions, the boat, the book cover, etc.), each described in one reusable sentence.
- 画面规格: 4:3 比例,720P(960x720,或工具支持的最接近 4:3 的尺寸),所有分镜统一。画面构成可参考用户 IMA 知识库「个人知识库/绘本库/古诗绘本画面」文件夹下的图片。
Step 7: Generate 4 Candidates per Scene (候选图生成与人工挑选)
- 告知成本: before generating, inform the user that each image costs roughly 5-10 credits (N scenes × 4 = 4N images) and confirm to proceed.
- 生成候选图: for each scene, call ImageGen 4 times. Each prompt = 风格设定卡(逐字嵌入)+ 该分镜的画面描述 + 候选变体维度。参考图(必做):先从用户 IMA 知识库获取「个人知识库/绘本库/绘本主角形象」文件夹下的图片作为主角形象参考(通过 image 参数传入以固定主角形象);「个人知识库/绘本库/古诗绘本画面」文件夹下的图片可作为画面构成参考。若 IMA 不可用,请用户连接 ima-mcp 连接器或提供参考图后再生成。The 4 candidates of one scene share style, characters, and subject; they vary in composition/angle/lighting/mood detail (variation dimensions listed in
references/image_generation_guide.md). Usequality: mediumfor candidates to save credits. Save tooutput/<作品名>/candidates/with namingS01_c1.png…S01_c4.png.
- If ImageGen is unavailable, fall back to any free image-generation tool at hand, keeping the same prompt structure and naming.
- 逐张生成 + 即时重命名:每次生成一张后立即重命名为目标文件名(如S00_c1.png),避免并行生成导致文件覆盖。 - 呈现并等待挑选: build a selection contact sheet from
assets/selection_sheet_template.html(one row per scene, candidates labeled A-D), open it for the user, and also present the image files via present_files. Then STOP and explicitly wait for the user to manually pick exactly one candidate per scene (e.g. reply "S01-B, S02-A, …"). Never auto-select or proceed on the user's behalf. Record picks inoutput/<作品名>/selected/(copy chosen files asS01.png,S02.png, …).
Step 8: Per-Scene Modification & Finalization (逐分镜修改确认与最终底稿)
用户挑选完成后,逐张与用户确认修改意见,修改后确定最终底稿。
- 逐张询问修改意见:对每个分镜已选中的图片,向用户展示该图并询问:
> "这是 S01 的已选图片。您对这张图片有什么修改意见吗?比如:调整颜色、增加/删除细节、修改主角表情或姿态等。如果没有修改意见,回复'确认'即可。" - 根据反馈修改:若用户提出修改意见,使用 ImageGen 图生图模式(
image参数传入当前已选图)生成修改后的版本:
- prompt = 风格设定卡 + 用户修改要求 + "保持原有构图和主体不变,仅根据以下要求调整:[用户反馈]"
-quality: high
- 保存为output/<作品名>/revised/S01_r1.png
- 展示修改后的图片,再次询问用户是否满意。若仍有修改意见,继续迭代(S01_r2.png…),直到用户确认满意。 - 确定最终底稿:用户确认满意后(或一开始就没有修改意见),将该图复制到
output/<作品名>/final/作为最终底稿:
- 有修改:cp revised/S01_r{最终次数}.png final/S01_final.png
- 无修改:cp selected/S01.png final/S01_final.png - 保存最终底稿到 IMA:将
final/中的每张最终底稿上传到 IMA 知识库「绘本库 → 古诗绘本画面 → [古诗名称]」文件夹。
- 逐张上传,文件名保持S00_final.png、S01_final.png等。
- 上传流程参见上方「IMA 知识库集成」。 - 呈现最终底稿:用 present_files 展示全部最终底稿,告知用户已保存到 IMA。
Stage 2 Output Directory Layout (阶段二输出目录)
output/<作品名>/
├── style_bible.md # 风格设定卡
├── candidates/ # 每分镜4张候选图 S01_c1.png … S01_c4.png
├── selected/ # 用户挑选结果 S01.png …
├── revised/ # 修改迭代图 S01_r1.png, S01_r2.png …
└── final/ # 最终底稿 S01_final.png …
Workflow — Stage 3: Text Panel & Combined Image (阶段三:文字面板与拼接图)
阶段二完成后,为每个分镜生成文字面板图片,与阶段二的画面拼接,组成完整的绘本分镜图。
> 加载参考:生成文字面板前,加载 references/text_panel_guide.md 获取详细的排版规则、字体选择和 Python 脚本使用说明。
Step 9: Generate Text Panels (生成文字面板)
为每个分镜生成一张 4:3 比例、纯白色底的文字面板图片,包含该分镜对应的:
1. 古诗原文:字体更大,加粗显示
2. 白话文讲述:字体较小,常规字重
生成方式:使用 assets/generate_text_panel.py 脚本(基于 Python PIL/Pillow):
- 输入:分镜编号、古诗原文、白话文讲述、输出路径
- 输出:4:3 比例(960x720)纯白底 PNG 图片
- 字体:古诗原文使用大号加粗黑体,白话文讲述使用中号常规字体
- 排版:古诗原文居中靠上,白话文讲述居中靠下,整体与 4:3 页面比例协调
逐分镜生成,保存到 output/<作品名>/text/ 目录,命名为 S00_text.png、S01_text.png 等。
Step 10: Combine Images & Save to IMA (拼接图片并保存到 IMA)
将阶段二的最终底稿(上半部分)与阶段三的文字面板(下半部分)垂直拼接,组成完整的绘本分镜图。
拼接方式:使用 assets/combine_images.py 脚本(基于 Python PIL/Pillow):
- 输入:阶段二最终底稿路径(上半部分)、阶段三文字面板路径(下半部分)、输出路径
- 输出:垂直拼接的大图(宽 960px,高 1440px = 720 + 720)
- 拼接规则:阶段二画面在上半部分,阶段三文字面板在下半部分
逐分镜拼接,保存到 output/<作品名>/combined/ 目录,命名为 S00_combined.png、S01_combined.png 等。
保存拼接图到 IMA:将 combined/ 中的每张拼接图上传到 IMA 知识库「绘本库 → 古诗绘本画面 → [古诗名称]」文件夹。
- 逐张上传,文件名保持 S00_combined.png、S01_combined.png 等。
- 上传流程参见上方「IMA 知识库集成」。
呈现最终成果:用 present_files 展示全部拼接图,告知用户已保存到 IMA。
Stage 3 Output Directory Layout (阶段三输出目录)
output/<作品名>/
├── text/ # 文字面板 S00_text.png, S01_text.png …
└── combined/ # 拼接图 S00_combined.png, S01_combined.png …
Complete Output Directory Layout (完整输出目录)
output/<作品名>/
├── style_bible.md # 风格设定卡(阶段二)
├── candidates/ # 候选图 S01_c1.png … S01_c4.png(阶段二)
├── selected/ # 用户挑选结果 S01.png …(阶段二)
├── revised/ # 修改迭代图 S01_r1.png …(阶段二)
├── final/ # 最终底稿 S01_final.png …(阶段二)
├── text/ # 文字面板 S01_text.png …(阶段三)
└── combined/ # 拼接图 S01_combined.png …(阶段三)
Storytelling Principles
- 第一人称旁白 + 第三人称画面 (First-Person Narration, Third-Person Visuals): 旁白(白话文讲述)全程使用"我"(小读者)作为叙述者:"我蹲在池塘边""我听到远处传来""我伸手摸了摸"。画面采用第三人称视角,主角完整入画、亲身经历诗中故事。Never use third-person narration ("诗人看到...") or second-person ("你看到了...") in the narration. If the poem's original author perspective is needed, frame it as "我遇到了一位诗人爷爷,他告诉我...".
- Child-friendly language: Use words a 3-8 year old can understand. Avoid abstract philosophical terms. Replace "借景抒情" with "看着这片风景,我心里暖暖的".
- Sensory richness through "我"的感官: Every scene should engage at least two of the child's senses — what "我" sees, hears, smells, touches, or feels. "我闻到了花香""脚下的草地软软的""风凉凉地吹过我的脸".
- Emotional arc: The scenes should flow from curious/excited (entering) → wonder/exploring (承) → moved/climax (转) → warm reflection (合, leaving), mirroring the poem's 起承转合.
- Visual continuity with 主角在场: The protagonist is fully visible in every scene with a consistent appearance (age, hairstyle, clothing — aligned with the IMA 主角形象参考图). Characters and settings should be consistent. If the protagonist meets a fisherman in scene 3, he should still be there in scene 4 if the poem implies continuity. The protagonist's interaction with the environment evolves naturally.
- Educational value through discovery: The vernacular narration should help children understand what the poem means through "我"的发现 and 体验, not just paraphrase it. Add gentle context where needed ("一位老爷爷告诉我,在古代,人们喜欢...").
- Pacing: Keep each scene's narration to 2-3 short sentences. Total video duration for a typical 绝句 (4 lines) should be 60-90 seconds including cover and ending.
Example
Input poem: 《咏鹅》骆宾王
鹅,鹅,鹅,曲项向天歌。
白毛浮绿水,红掌拨清波。
Output (abbreviated; narration first-person, visuals third-person):
> S00 | 封面 — 进入故事
> - 原文: 咏鹅 · 骆宾王(唐)
> - 白话文讲述: 我翻开绘本,一阵风吹来——咦?我好像来到了一个池塘边!水面上有什么在动……
> - 画面描述: 第三人称视角,中景。主体:绘本主角(约6岁,齐耳短发,鹅黄色小衫,深蓝色布鞋)正从一本翻开的厚厚绘本旁走进画面,回头惊喜地张望;碧绿水面中央一只大白鹅优雅地浮着,周围散落几片圆圆的荷叶,岸边嫩绿草地开满小野花,一只蓝色蜻蜓停在荷叶尖上。场景:时间清晨,天气晴,天空淡蓝白云,阳光暖黄。构图:平视中景,主角位于画面左三分之一处。艺术风格:儿童绘本绘画。画质:4:3 比例,720P。
> - 预计时长: 5s
>
> S01 | 第一句
> - 原文: 鹅,鹅,鹅,曲项向天歌。
> - 白话文讲述: 我蹲在池塘边,探出头去——哇!水面上有好几只大白鹅!最近的一只弯着长长的脖子,仰头对着天空叫起来——"嘎嘎嘎!"声音好响亮,我吓得往后一坐,又忍不住咯咯笑了起来。
> - 画面描述: 第三人称视角,全景。主体:绘本主角蹲在池塘岸边,双手撑着膝盖,探出头惊喜地看着水面,嘴角咧开笑;碧绿的水面上三只大白鹅排成一排,最近的一只弯着长脖子仰头张嘴鸣叫,头顶画着几个音符;水面漂着荷叶,一只小青蛙趴在荷叶上张大嘴看鹅。场景:时间正午,天气晴,天空白云朵朵,阳光洒下金色光斑。构图:平视全景,主角在左,鹅群在右。艺术风格:儿童绘本绘画。画质:4:3 比例,720P。
> - 预计时长: 12s
>
> S02 | 第二句
> - 原文: 白毛浮绿水,红掌拨清波。
> - 白话文讲述: 我趴在岸边看得更仔细了。大白鹅的毛白白的,像天上的云朵一样,浮在绿绿的水面上。我低头一看,水底下它的红脚掌正一划一划地拨着水,一圈一圈的小水纹散开,好漂亮呀!我忍不住伸手去摸了摸水面,凉凉的。
> - 画面描述: 第三人称视角,近景。主体:绘本主角趴在岸边,圆乎乎的小手伸向水面,指尖碰到水面溅起小水珠,表情专注好奇;大白鹅白毛浮在碧绿水面,水下清晰可见红色脚掌正在拨水,一圈圈水纹散开;水面漂着荷叶和小黄花,一条小鱼探出头吐泡泡,岸边草丛一只小蜗牛慢慢爬,一只红蝴蝶绕着鹅飞。场景:时间正午,天气晴,阳光明亮。构图:平视近景,主角与鹅同框。艺术风格:儿童绘本绘画。画质:4:3 比例,720P。
> - 预计时长: 12s
>
> S03 | 结尾 — 离开故事
> - 原文: (总结)
> - 白话文讲述: 风又吹来了,我回过头看了看池塘。大白鹅还在水面上游来游去呢。我轻轻合上绘本,心里想:大白鹅,下次我再来找你们玩!
> - 画面描述: 第三人称视角,中景。主体:绘本主角站在岸边朝池塘挥手告别,笑容灿烂;大白鹅在远处水面游弋,柳枝在风中轻摆;主角脚边放着一本合上的绘本,书封嫩绿色,正中毛笔字"咏鹅"两字,右下角一枚红色印章,书旁草地上落着一片荷叶。场景:时间黄昏,天气晴,阳光暖黄。构图:平视中景,主角位于画面右侧,回望左侧池塘。艺术风格:儿童绘本绘画。画质:4:3 比例,720P。
> - 预计时长: 8s
Resources
references/
storyboard_guide.md— Detailed guide on static visual design (rich, childlike elements), age-appropriate language levels, and pacing for children's picture book scripts.image_generation_guide.md— Detailed guide for Stage 2: style bible template, candidate prompt structure, 4-candidate variation dimensions, ImageGen parameters and credit notes, naming conventions, modification workflow, and IMA save instructions.text_panel_guide.md— Detailed guide for Stage 3: text panel layout rules, font selection, Python script usage for text panel generation and image combination.
assets/
script_template.md— Markdown output template for the complete picture book video script.script_template.json— JSON structured output template for machine-readable script data.selection_sheet_template.html— Contact-sheet page for the user to review 4 candidates per scene and manually pick one (labels A-D).generate_text_panel.py— Python script (PIL/Pillow) to generate 4:3 white-background text panel images with poem text (large bold) and vernacular narration (smaller regular).combine_images.py— Python script (PIL/Pillow) to vertically combine Stage 2 final images (top) with Stage 3 text panels (bottom).