⚠️ Core Principle: Propose First, Generate Later
Absolutely never skip the design proposal and generate images directly. Correct process:
理解内容 → 设计提案(2-3个方向)→ 用户选择 → 生成 → 预览确认 → 上传
For design aesthetic profiles and proposal formats, see the sister skill xhs-image/SKILL.md, which also applies to WeChat official account images.
Core Parameters
| Image Type | Size | Ratio | Playwright viewport | AI Prompt Aspect Ratio Declaration |
|---|---|---|---|---|
| Headline Cover | 1800 x 766 px | 2.35:1 | --viewport-size=1800,766 |
2.35:1 ultra-wide landscape, 1800x766 pixels |
| Body Wide Image | 1920 x 1080 px | 16:9 | --viewport-size=1920,1080 |
16:9 landscape, 1920x1080 pixels |
| Body Square Image | 1440 x 1080 px | 4:3 | --viewport-size=1440,1080 |
4:3 landscape, 1440x1080 pixels |
| Infographic | 1080 x Free | Free | --viewport-size=1080,N |
Determined by content |
Step 0: Determine Image Requirements ✅ User Confirmation
Show options to the user and wait for confirmation:
| Type | Description | Number of Images | Recommended Path |
|---|---|---|---|
| A. Cover Only | Headline cover image | 1 image | AI generation |
| B. Body Images | Section illustrations to aid reading comprehension | 3-8 images | Mainly AI generation |
| C. Full Set of Images | Cover + all body images | 4-10 images | Mainly AI generation |
| D. Pure Infographics | Data comparisons, flowcharts, checklists | 1-5 images | AI generation (use HTML as fallback for precise data tables) |
Ask the user:
- Do you want a cover, body illustrations, or the full set?
- What is the article path/content? (Analyze the content to determine image placement)
- How many images are needed in total?
Image Quantity Recommendations
| Article Length | Recommended Number of Images | Includes |
|---|---|---|
| < 1500 words | 2-3 images | Cover + 1-2 body images |
| 1500-3000 words | 4-6 images | Cover + 1 image per core section |
| 3000-5000 words | 6-8 images | Cover + section images + infographics |
| > 5000 words | 8-10 images | No more than 10 images, to avoid excessive interruption |
Step 1: Style Selection ✅ User Confirmation
Based on the user's article type, recommend 3 styles for selection.
Automatically recommended by article type
| Article Type | First Recommendation | Second Recommendation | Third Recommendation |
|---|---|---|---|
| AI Tool Review | Minimalist Professional | Editorial Magazine | Data Infographic |
| Technical Tutorial | Minimalist Professional | Hand-drawn Whiteboard | Editorial Magazine |
| Product Launch | Editorial Magazine | Big-Character Poster | Minimalist Professional |
| In-Depth Analysis | Editorial Magazine | Data Infographic | Minimalist Professional |
| Personal Story | Snoopy Warm Comic | Warm Narrative | Editorial Magazine |
| Industry Observation | Big-Character Poster | Editorial Magazine | Data Infographic |
Show the user 3 recommended styles, each including:
- Style name + one-sentence description
- Use cases
- Color tendency
Ask the user: Which style do you want? Or do you have your own reference in mind?
Complete style library: references/style-gallery.md
Step 2: Choose generation path ✅ User confirms
Recommend a path based on content characteristics, and show the comparison to the user:
| Path A: HTML → Screenshot | Path B: AI Generation | |
|---|---|---|
| Text accuracy | 100% (code-controlled) | Chinese may have errors (needs verification) |
| Layout control | Pixel-level precision | AI free-form |
| Visual creativity | Medium (depends on design ability) | High (AI is creative) |
| API cost | Zero (purely local) | Each image consumes Gemini API |
| Speed | Fast (a few seconds) | Slow (10-30 seconds/image) |
| Suitable for | Lots of text, lots of data, lists, infographics | Covers, atmosphere images, creative illustrations |
| Editability | Just modify the HTML and take a new screenshot | Needs to be regenerated |
| Dark mode | CSS directly controls the color scheme | Must be declared in the prompt |
⚠️ Huashu preference: AI generation first
HTML screenshots look too flat, like PowerPoint templates, lacking texture and design sense. AI-generated images have rich visual details, and the quality far exceeds HTML. By default, use the AI generation path. Only use HTML as a fallback for "complex data tables that must be verbatim accurate."
Path recommendation rules
| Image type | Recommended path | Reason |
|---|---|---|
| Headline cover | AI | Strong visual impact, good texture |
| Body atmosphere/scene image | AI | Highly creative |
| Body infographic | AI | AI can create infographics with a sense of design |
| Flowchart/step diagram | AI | AI can add visual hierarchy |
| Comparison chart | AI | Higher visual quality |
| Precise data table (10+ cells) | HTML | The only scenario that needs HTML: large amounts of precise numbers |
By default, recommend the AI path; no longer ask about path selection each time.
Step 3: Generate image
Path A: HTML → Playwright Screenshot
3-A-1. Create HTML
Based on the selected style and the content provided by the user, generate an HTML file.
HTML template requirements:
- Canvas size: choose according to image type (cover 1800x766, body wide image 1920x1080, body square image 1440x1080)
- Font:
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif - Dark mode friendly: use #F5F5F5 instead of pure white, use #1A1A2E instead of pure black
- Cover safe zone: core information concentrated in the central square area (766x766)
Cover big-text poster template example (2.35:1):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
width: 1800px; height: 766px;
background: #1A1A2E;
display: flex; flex-direction: column;
justify-content: center; align-items: center;
padding: 60px 400px; /* 左右大padding确保内容在安全区 */
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.title {
font-size: 96px; font-weight: 900;
color: #FFFFFF; text-align: center;
line-height: 1.3; letter-spacing: 4px;
}
.subtitle {
font-size: 36px; font-weight: 400;
color: #E2B714; text-align: center;
margin-top: 30px;
}
.accent-line {
width: 200px; height: 4px;
background: #E2B714;
margin: 30px auto;
}
</style>
</head>
<body>
<div class="title">Claude vs Codex</div>
<div class="accent-line"></div>
<div class="subtitle">重度用户的20分钟实战对比</div>
</body>
</html>
Body infographic template example (4:3):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
width: 1440px; height: 1080px;
background: #F5F5F5;
padding: 60px 80px;
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.heading {
font-size: 56px; font-weight: 800;
color: #1A1A1A; margin-bottom: 40px;
line-height: 1.3;
}
.item {
display: flex; align-items: flex-start;
margin-bottom: 28px; gap: 20px;
}
.num {
font-size: 40px; font-weight: 900;
color: #4A90D9; min-width: 50px;
}
.text {
font-size: 32px; color: #333;
line-height: 1.5;
}
.highlight { color: #FF6B35; font-weight: 700; }
</style>
</head>
<body>
<div class="heading">Claude Code 五大优势</div>
<div class="item"><span class="num">01</span><span class="text"><span class="highlight">Agent模式</span>自主规划执行复杂任务</span></div>
<div class="item"><span class="num">02</span><span class="text">原生<span class="highlight">终端集成</span>直接操作文件系统</span></div>
<div class="item"><span class="num">03</span><span class="text"><span class="highlight">多文件编辑</span>一次修改整个项目</span></div>
</body>
</html>
3-A-2. Screenshot
npx playwright screenshot "file:///path/to/card.html" output.png \
--viewport-size=[宽],[高] --wait-for-timeout=1000
- Cover:
--viewport-size=1800,766 - Body wide image:
--viewport-size=1920,1080 - Body square image:
--viewport-size=1440,1080
3-A-3. ✅ Preview confirmation
Use the Read tool to show the screenshot result to the user.
Ask the user:
- Is the text content correct?
- Are you satisfied with the layout and color scheme?
- Is the cover's core information within the safe zone? (Cover image only)
- What needs to be adjusted?
If adjustment is needed: modify HTML → take screenshot again → confirm again. (The iteration cost of the HTML path is extremely low)
Path B: AI generation (Gemini 3 Pro Image)
3-B-1. Build Prompt
Cover Base Style Prompt:
[Base Style]:
VISUAL REFERENCE: [一句话描述具体风格美学]
CANVAS: 2.35:1 ultra-wide landscape, 1800x766 pixels, high quality rendering.
SAFE ZONE: Center square (766x766) contains all key text and visuals.
COLOR SYSTEM: [描述色彩情绪,不指定比例]
TEXT RENDERING: Chinese text must be large, clear, readable. Title in center safe zone.
Body Base Style Prompt:
[Base Style]:
VISUAL REFERENCE: [一句话描述具体风格美学]
CANVAS: [16:9 landscape, 1920x1080 pixels / 4:3 landscape, 1440x1080 pixels], high quality rendering.
COLOR SYSTEM: [描述色彩情绪]
DARK MODE: Use medium-tone backgrounds, avoid pure white (#FFFFFF) and pure black (#000000).
Per-Image Prompt:
Create a [style] [cover/illustration] for a WeChat article about [topic].
[Base Style]
DESIGN INTENT: [用户看到后应该产生什么情绪/行为]
TEXT TO RENDER:
- Title: "[标题,封面≤10字,正文可少或无]"
- [其他文字]
[1-2句画面情绪描述,让 AI 自由发挥构图]
3-B-2. ✅ Prompt confirmation
Show the prompt to be used to the user, and wait for confirmation or modification. Especially confirm:
- Whether the text content to be rendered is correct
- Whether the design intent is accurate
- Whether there are any other requirements
3-B-3. Generate
export $(grep GEMINI_API_KEY ~/.claude/.env) && \
uv run /Users/alchain/Documents/写作/.claude/skills/wechat-image/scripts/generate_image.py \
--prompt "[完整prompt]" \
--filename "[timestamp]-wechat-[类型]-[描述].png" \
--aspect [cover|wide|standard|square]
--aspect cover→ 2.35:1 headline cover--aspect wide→ 16:9 body wide image (default)--aspect standard→ 4:3 body square image--aspect square→ 1:1 square image
Multiple images can be generated in parallel (run_in_background=true)。
3-B-4. ✅ Preview confirmation
Use the Read tool to show the generation result to the user.
Checklist:
- Is the text accurate? (No garbled characters or typos in Chinese)
- Is the ratio correct? (Cover 2.35:1, body 16:9 or 4:3)
- Cover safe zone: is the core information within the central square? (Cover only)
- Dark mode: has pure white background and pure black background been avoided?
- Are you satisfied with the style?
Ask the user: satisfied / regenerate / adjust prompt?
Path C: Hybrid path (recommended for full sets of illustrations)
Suitable for full sets of illustrations:Use AI generation for the cover (eye-catching), use HTML rendering for body infographics (precise information), use AI generation for body atmosphere images。
Execution order:
- First generate the cover according to Path B → user confirmation
- Extract a consistent style from the cover's color scheme/atmosphere
- Use Path B for body atmosphere images → user confirmation
- Use Path A for body infographics/data charts → user confirmation
Step 4: Upload to image hosting
python3 /Users/alchain/Documents/写作/tools/upload_image.py "[图片路径]"
Return the ImgBB permanent link.WeChat Official Account articles must use network links, local paths become invalid after publishing.
Quick reference
Cover safe area
┌─────────────────────────────────────┐
│ │ 766x766 │ │
│ 装饰区 │ 安全区域 │ 装饰区 │ 1800 x 766
│ │ (核心) │ │
└─────────────────────────────────────┘
↑ 朋友圈裁切区域 ↑
Key points for dark mode adaptation
- Use #F5F5F5 (light gray) instead of pure white for the background color
- Use #1A1A2E (dark purple-gray) instead of pure black for the background color
- Use #595959 or #3F3F3F for body text color, not pure black #000000
- Avoid shadow effects and white borders
- Use low-saturation color schemes
Chinese text rendering (unique to AI path)
- Cover title ≤ 10 characters
- Text on body images ≤ 20 characters/line
- Rendering infographic text in HTML is more reliable
- Must verify each image one by one
Font recommendations (unique to HTML path)
- Title:
"PingFang SC"Bold /"Microsoft YaHei"Bold - Body:
"PingFang SC"Regular - Commercially safe alternatives: Alibaba PuHuiTi, Source Han Sans
Huashu Tech account color scheme
| Scheme name | Background | Primary color | Accent color | Use case | Dark mode |
|---|---|---|---|---|---|
| Warm Gray Professional | #F5F0EB | #D97706 | #4A90D9 | AI tools, sharing | Good |
| Minimal Professional | #F5F5F5 | #4A90D9 | #FF6B35 | Tutorials, comparisons | Medium |
| Midnight Gold | #1A1A2E | #E2B714 | #FFFFFF | Product launches | Good |
| Terminal Green | #1A1A1A | #00FF41 | #888888 | Programming-related | Good |
Golden Rules
- Place the cover's core information in the central square safe area
- Use mid-tone backgrounds for body images (compatible with dark mode)
- For infographics, prioritize HTML → screenshot (accurate text)
- For atmospheric images, prioritize AI generation (highly creative)
- Upload images to an image hosting service to get permanent links
- Keep illustration style consistent within the same article
- Include one image every 800-1200 characters
- At least one image per H2 section
Image placement strategy
| Position | Necessity | Type |
|---|---|---|
| Below the title (cover) | Required | Cover image / atmospheric image |
| After each H2 heading | Recommended | Section illustration |
| At data/comparison points | Recommended | Infographic |
| At product/tool introductions | Optional | Screenshot / AI concept image |
| Before the concluding summary | Optional | Closing illustration |
Decision flowchart
用户需求 → Step 0 确定需求
↓
Step 1 选风格(展示3个选项)
↓
Step 2 默认AI生成(仅精确数据表格走HTML)
↓
Step 3 生成 → 预览 → 用户确认
├→ 满意 → Step 4 上传
├→ 文字渲染有误 → 该张改用HTML兜底
└→ 不满意 → 调整prompt重新生成
Related Skills
| Skill | Function |
|---|---|
xhs-image |
Xiaohongshu illustrations (sister skill) |
image-to-slides |
PPT illustrations (source of the style library) |
Reference files
references/style-gallery.md— Complete style library and prompt templatesreferences/design-guidelines.md— WeChat Official Account platform design guidelines
Produced by Huashu | AI Native Coder · Indie Developer WeChat Official Account "Huashu" | 300k+ followers | AI tools and productivity Representative works: Xiaomao Fill Light (Top 1 on AppStore paid chart) · "One Book to Master DeepSeek"