Configuration
| Configuration Item | Value |
|---|---|
| API | 配置文件中设置 |
| Image generation model | 配置文件中设置 |
| Vision model | 配置文件中设置 |
| Configuration file | config/settings.json |
Execution specifications
- Script usageAbsolute pathcall, save the image tocurrent working directory
- PromptMust use Chinese, title labels in the imagemust be in Chinese
- when containing Chinese text, append the text clarity suffix from
guides/text-rendering.mdtext within is clear suffix - Default aspect ratio 16:9, default for vertical scenarios (Xiaohongshu/comics) 3:4
🔀 Scenario routing (iron rule: first step after receiving a request)
收到生图需求
│
├─ 信息图/数据可视化/架构图/流程图/对比图/鱼骨图/思维导图/金字塔/漏斗/韦恩图/冰山图
│ → 📊 信息图 → scenes/infographic/
│
├─ 封面/头图/banner/公众号封面/文章封面
│ → 🖼️ 封面图 → scenes/cover/
│
├─ 长图/微信长图/多屏/从上到下/竖版长图/分段/多个段落
│ → 📜 长图 → scenes/long-image/
│
├─ 幻灯片/PPT图/slides/演示文稿
│ → 📑 幻灯片 → scenes/slide-deck/
│
├─ 漫画/连环画/分镜/绘本/知识漫画/故事图
│ → 📖 漫画 → scenes/comic/
│
├─ 文章插图/自动配图/智能插图/给文章配图
│ → ✏️ 文章插图 → scenes/article-illust/
│
├─ 小红书/笔记配图/种草图/卡片系列
│ → 📱 小红书图 → scenes/xhs/
│
├─ 海报/主图/电商/促销/九宫格/产品图/营销/物料
│ → 🛍️ 营销物料 → scenes/marketing/
│
├─ 改图/编辑图片/风格转换/基于这张图
│ → 🔄 图生图 → core/image_to_image.py(直接执行)
│
├─ 分析图片/OCR/识别文字/描述图片/图生文
│ → 👁️ 图生文 → core/image_to_text.py(直接执行)
│
└─ 其他单图需求(一张图,无特殊场景)
→ 🎨 单图 → core/text_to_image.py(直接执行)
After routing to a scenario → load that scenario's README.md to get detailed parameters and usage → operate according to the execution flow below.
📋 General execution flow (shared by all scenarios)
Step 1: Analyze requirements
- Clarify what to generate (theme, content points)
- Determine the scenario type (already determined by routing)
- Determine the quantity (how many images)
- Determine the ratio (16:9 / 3:4 / 1:1, etc.)
Step 2: Plan the solution (required for multi-image scenarios)
Single image: can be skipped and generated directly. Multi-image scenarios (long image/slides/comics/Xiaohongshu/article illustrations): must first output a plan and execute after user confirmation.
Plan output format:
| 序号 | 内容概要 | 类型/布局 |
|-----|---------|----------|
| 1 | xxx | xxx |
| 2 | xxx | xxx |
**场景**:xx | **风格**:xx | **比例**:xx | **预计**:N张
Step 3: Execute generation
| Scenario | Execution method | Rules |
|---|---|---|
| 📊 Infographic | Scenario script called directly | Single image can be concurrent |
| 🖼️ Cover image | Scenario script called directly | Single image |
| 📜 Long image | core engine serial | Iron rule: must be serial! First screen text_to_image, subsequent image_to_image references the previous screen, finally merge and stitch |
| 📑 Slides | Scenario script page by page | Generate page by page serially |
| 📖 Comics | Scenario script page by page | Serial! The first page text_to_image sets the tone, subsequent image_to_image references the previous page |
| ✏️ Article illustrations | Scenario script batch | Each chapter is independent and can be concurrent (≤8 images) |
| 📱 Xiaohongshu | Scenario script image by image | Serial! The first image sets the tone, subsequent ones reference the previous image to keep the style consistent |
| 🛍️ Marketing materials | core engine + template | Same style can be concurrent (≤8 images) |
| 🔄 Image-to-image | core called directly | Single image |
| 🎨 Single image | core called directly | Single image |
Step 4: Quality Check
- After generation is complete,images containing Chinese textUsing
core/image_to_text.py -m ocrverify whether the text is clear - OCR result does not match expectations → use
core/image_to_image.pyiterative fixes (refer toguides/text-rendering.md) - After the multi-image scenario is complete, show them to the user one by one for confirmation, and regenerate any individual image the user is not satisfied with
🛠️ Script Quick Reference
Scenario Scripts
# 📊 信息图 — 20布局×17风格=340种
python3 scenes/infographic/zlab_infographic.py -l {布局} -s {风格} -n "标题" -c "内容" -o out.png
python3 scenes/infographic/zlab_infographic.py --list # 查看所有选项
# 🖼️ 封面图 — 五维定制=3888种
python3 scenes/cover/zlab_cover.py -n "标题" --type {类型} --palette {配色} --rendering {渲染} --text {文字} --mood {氛围} -o out.png
# 📑 幻灯片 — 16种预设
python3 scenes/slide-deck/zlab_slide_deck.py article.md --style {预设} -o slides/
python3 scenes/slide-deck/zlab_slide_deck.py article.md --outline-only # 仅看大纲
# 📖 漫画 — 5画风×7基调×6布局=210种
python3 scenes/comic/zlab_comic.py source.md --art {画风} --tone {基调} --layout {布局} -o comic/
# ✏️ 文章插图 — 6类型×8风格=48种
python3 scenes/article-illust/zlab_article_illustrator.py article.md --style {风格} -o images/
# 📱 小红书 — 9风格×6布局=54种
python3 scenes/xhs/zlab_xhs_images.py content.md --style {风格} --layout {布局} -o xhs/
All scenario scripts support --list to view available options.
Core Engine
# 文生图
python3 core/text_to_image.py "中文描述" -r 16:9 -o output.png
python3 core/text_to_image.py "描述" -r 3:4 --ref ref.png -o output.png # 参考图风格
# 图生图
python3 core/image_to_image.py input.png "编辑描述" -r 3:4 -o output.png
# 图生文
python3 core/image_to_text.py image.jpg -m describe|ocr|chart|fashion|product|scene
# 长图拼接
python3 core/merge_long_image.py img1.png img2.png -o output.png --blend 20
python3 core/merge_long_image.py -p "*.png" -o output.png --sort name
Supported ratios:1:1 2:3 3:2 3:4 4:3 4:5 5:4 9:16 16:9 21:9
📚 General Guide (load as needed)
| Trigger Conditions | File | When to Load |
|---|---|---|
| Image contains Chinese text | guides/text-rendering.md |
When the prompt requires Chinese titles/labelsMust load |
| Create images for PPT/documents | guides/color-sync.md |
Load when color coordination with other media is needed |
| Need to optimize image generation results | guides/prompt-guide.md |
Load when image generation results are unsatisfactory and need improvement |
| API interface issues | guides/api-reference.md |
Load when debugging the underlying interface |
| Generate multi-screen long images | scenes/long-image/README.md |
When routing to the long-image scenarioMust load |
| Marketing material templates | scenes/marketing/templates.md |
When routing to the marketing scenarioMust load |