SuperAPI AI Directory

article-batch-illustration

Design & creation

View repository

Updated 10-16 08:40

About this skill

Batch article illustrations

Analyze the Markdown article structure, generate illustration prompts for each paragraph/section, call the Gemini API to batch-generate images and insert them into the document.

Workflow

Phase 1: Analyze the article → generate prompts

  1. Read the article - Obtain the article content provided by the user (the currently open file or a specified path)
  2. Structure analysis - Split paragraphs by H2/H3 headings, extract the core idea of each paragraph
  3. Generate style instructions - Generate a global STYLE INSTRUCTIONS code block based on the article topic
  4. Generate prompts - Create an image prompt outline for each paragraph (refer to references/style-guide.md)
  5. Display and confirm - Display all prompts as a list, wait for user confirmation or modification

Phase 2: Generate images → insert into document

  1. Batch generation - Call scripts/generate_image.py to generate images one by one
  2. Save images - Save to the obsidian/09image/MMDD-主题名称/ directory
  3. Insert into document - Insert after each paragraph heading the ![[图片路径]] reference

Phase 1 Detailed Guide

1. Article structure analysis

After reading the article, split it according to the following rules:

  • Use ## (H2) or ### (H3) headings as paragraph separators
  • Ignore the frontmatter (YAML) section
  • Ignore auxiliary content such as pure quotes, footnotes, etc.
  • Extract for each paragraph: heading, core point (1 sentence), key concepts (3-5 words)

Output format:

## 文章结构分析

| # | 段落标题 | 核心观点 | 关键概念 |
|---|---------|---------|---------|
| 1 | xxx     | xxx     | A, B, C |
| 2 | xxx     | xxx     | D, E, F |

2. Generate global style instructions

Before all prompts, a STYLE INSTRUCTIONS block must first be generated. Read references/style-guide.md to obtain the style template.

Use by defaultstyle 1 (minimalist hand-drawn style), the user may choose style 2 (architectural blueprint editorial style).

STYLE INSTRUCTIONS:
- 整体风格: 简约手绘风格 / 建筑蓝图编辑风格
- 色彩方案: 白底为主,黑色线条,[主题点缀色]
- 比例: 16:9 横版
- 分辨率: 2K
- 文字量: 极少,仅保留1-3个核心关键词
- 文字语言: 图片中文字以简体中文为主,专业术语/缩写(如 AI、API、LLM)可保留英文
- 视觉语言: 逻辑图、流程图、概念图
- 一致性: 统一线条粗细、留白比例、排版网格

3. Generate a prompt for each paragraph

Structure of each prompt:

  1. Style prefix - General description from STYLE INSTRUCTIONS
  2. Diagram type - Concept diagram/flowchart/comparison diagram/hierarchy diagram/relationship diagram
  3. Content description - Focused on the paragraph's core idea, describe the diagram content in narrative language
  4. Chinese labels - Write the Chinese keywords directly (such as "data collection", "intelligent processing"), 1-3 of them
  5. Chinese-priority instruction(required) - Append at the end of each prompt:ALL text, labels, and annotations in the image MUST be primarily in Chinese (Simplified Chinese, 中文). Use clean Chinese font for main text. Technical terms and abbreviations (e.g. AI, API, LLM, RAG) may remain in English.
  6. Exclusions - "No photography, no realistic elements, no complex gradients"

Display format (waiting for user confirmation):

## 提示词大纲

### 图 1: [段落标题]
- 图表类型: 概念图
- 提示词:
  """
  [完整英文提示词]
  """

### 图 2: [段落标题]
...

Key:

  • The main body of the prompt should be written in English (Gemini understands English prompts better)
  • Text labels that need to appear in the image should be written directly in the original Chinese (such as The central node labeled "AI生产力系统")
  • Each prompt must include the Chinese-priority instruction at the end, ensure the text in the image is primarily in Chinese, technical terms may remain in English

4. Wait for confirmation

After displaying all prompts, ask the user:

  • "Are you satisfied with the above prompts? Do you need to modify the description of any image?"
  • "After confirmation, batch image generation will begin (N images in total)"
  • The user may specify a different style for a certain image or modify the description

Phase 2 detailed guide

5. Call the API to generate images

After confirmation, call the script one by one to generate images:

python3 scripts/generate_image.py \
  --prompt "提示词内容" \
  --output "/Users/ugreen/Documents/obsidian/09image/MMDD-主题名/01-段落名.png" \
  --api-key "REMOVED_GEMINI_KEY" \
  --api-url "https://generativelanguage.googleapis.com" \
  --model "gemini-3-pro-image-preview" \
  --aspect-ratio "16:9" \
  --resolution "2K"

Notes:

  • MMDD takes the current date (e.g., 0206)
  • The topic name is extracted from the article's H1 title and simplified into a short name
  • Image number is two digits (01, 02, 03...)
  • After each image is generated, check the script output to confirm success
  • If an image fails, record it and continue to the next one, and report the failed items at the end
  • Interval of 2-3 seconds between images to avoid API rate limiting

6. Save path specification

/Users/ugreen/Documents/obsidian/09image/MMDD-主题简称/
├── 01-段落标题简称.png
├── 02-段落标题简称.png
├── 03-段落标题简称.png
└── ...

7. Insert into document

Insert image references below the corresponding paragraph headings in the article:

## 段落标题

![[09image/MMDD-主题简称/01-段落标题简称.png]]

段落正文内容...

Use Obsidian wikilink format ![[路径]] to insert.

API configuration

Configuration item Value
API URL https://generativelanguage.googleapis.com
API Key REMOVED_GEMINI_KEY
Model gemini-3-pro-image-preview
Default aspect ratio 16:9
Default resolution 2K

Style selection

Style Features Applicable scenarios
Style 1 (default) Minimalist hand-drawn, black lines, white background General, concept explanation, process description
Style 2 Architectural blueprint/technical journal, refined and minimalist System architecture, technical analysis, professional content

Users can select a global style during the confirmation phase, or specify a different style for an individual image.

Common usage

User says Action
"Add images to this article" Analyze the currently open article and add images in batch
"Batch add images" Same as above
"Add images to the article using Style 2" Use the architectural blueprint editing style
"Modify the prompt for the 3rd image" Regenerate the specified image
"Regenerate the 2nd image" Call the API again with the modified prompt