
Huashu Wechat Image
- 646 installs
- 1.3k repo stars
- Updated August 2, 2026
- alchaincyf/huashu-skills
huashu-wechat-image is a Claude Code skill that generates WeChat public-account cover images, inline illustrations, and infographics for developers who publish articles needing on-brand visuals at platform-specific dimen
About
huashu-wechat-image is a WeChat article image workflow skill with a mandatory propose-then-generate flow: understand content, present two to three design directions, user selects, then render and preview. It supports AI generation for creative visuals and HTML rendering for text-precise graphics. Documented sizes include 1800×766 px headline covers (2.35:1), 1920×1080 px body images (16:9), and additional aspect ratios with matching Playwright viewport flags such as --viewport-size=1800,766. Developers reach for this skill when building 公众号配图, covers, or infographics that must meet WeChat layout constraints before upload.
- Enforces strict workflow: never generate before first presenting 2-3 design proposals for user approval
- Supports four output types: headline cover (2.35:1), body wide (16:9), body square (4:3), and infographics
- Dual generation paths: AI visual creativity and HTML/CSS precise text rendering via Playwright
- Provides exact viewport sizes and aspect-ratio prompts for each format (1800x766, 1920x1080, 1440x1080)
- Recommends image count by article length: 2-3 for <1500 words up to 8-10 for >5000 words
Huashu Wechat Image by the numbers
- 646 all-time installs (skills.sh)
- Ranked #356 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/alchaincyf/huashu-skills --skill huashu-wechat-imageAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 646 |
|---|---|
| repo stars | ★ 1.3k |
| Last updated | August 2, 2026 |
| Repository | alchaincyf/huashu-skills ↗ |
What image sizes does WeChat require for article covers?
Generate high-quality, on-brand cover images, inline illustrations and infographics for WeChat public account articles.
Who is it for?
Developers or content teams publishing WeChat public-account articles who need correctly dimensioned, on-brand visuals.
Skip if: General social graphics outside WeChat specs, video production, or skipping the required design-proposal review step.
When should I use this skill?
A user mentions 公众号配图, 公众号封面, 文章配图, 正文插图, or WeChat article image generation.
What you get
WeChat-sized cover images, inline illustrations, infographics, design proposals, and Playwright-rendered previews ready for upload.
- WeChat cover images
- Inline article illustrations
- Infographic assets
By the numbers
- Headline cover size 1800×766 px at 2.35:1 ratio
- Body wide image size 1920×1080 px at 16:9 ratio
- Requires 2–3 design proposal directions before generation
Files
公众号配图工作流
⚠️ 核心原则:先提案,后生成
绝对不能跳过设计提案直接出图。 正确流程:
理解内容 → 设计提案(2-3个方向)→ 用户选择 → 生成 → 预览确认 → 上传设计审美画像和提案格式见姊妹skill xhs-image/SKILL.md,公众号配图同样适用。
核心参数
| 图片类型 | 尺寸 | 比例 | Playwright viewport | AI Prompt 长宽比声明 |
|---|---|---|---|---|
| 头条封面 | 1800 x 766 px | 2.35:1 | --viewport-size=1800,766 | 2.35:1 ultra-wide landscape, 1800x766 pixels |
| 正文宽图 | 1920 x 1080 px | 16:9 | --viewport-size=1920,1080 | 16:9 landscape, 1920x1080 pixels |
| 正文方图 | 1440 x 1080 px | 4:3 | --viewport-size=1440,1080 | 4:3 landscape, 1440x1080 pixels |
| 信息图 | 1080 x 自由 | 自由 | --viewport-size=1080,N | 按内容定 |
---
Step 0: 确定配图需求 ✅ 用户确认
向用户展示选项,等待确认:
| 类型 | 说明 | 图片数量 | 推荐路径 |
|---|---|---|---|
| A. 仅封面 | 头条封面图 | 1张 | AI 生成 |
| B. 正文配图 | 章节配图,辅助阅读理解 | 3-8张 | AI 生成为主 |
| C. 全套配图 | 封面 + 正文全部 | 4-10张 | AI 生成为主 |
| D. 纯信息图 | 数据对比、流程图、清单 | 1-5张 | AI 生成(精确数据表格用HTML兜底) |
问用户: 1. 做封面、正文插图、还是全套? 2. 文章路径/内容是什么?(分析内容确定配图位置) 3. 总共需要几张图?
配图数量建议
| 文章长度 | 推荐配图数 | 包含 |
|---|---|---|
| < 1500字 | 2-3张 | 封面 + 1-2张正文 |
| 1500-3000字 | 4-6张 | 封面 + 每个核心章节1张 |
| 3000-5000字 | 6-8张 | 封面 + 章节图 + 信息图 |
| > 5000字 | 8-10张 | 不超过10张,避免过度打断 |
---
Step 1: 风格选择 ✅ 用户确认
根据用户的文章类型,推荐 3 种风格供选择。
按文章类型自动推荐
| 文章类型 | 第一推荐 | 第二推荐 | 第三推荐 |
|---|---|---|---|
| AI工具评测 | 极简专业 | 编辑杂志 | 数据信息图 |
| 技术教程 | 极简专业 | 手绘白板 | 编辑杂志 |
| 产品发布 | 编辑杂志 | 大字报 | 极简专业 |
| 深度分析 | 编辑杂志 | 数据信息图 | 极简专业 |
| 个人故事 | Snoopy温暖漫画 | 温暖叙事 | 编辑杂志 |
| 行业观察 | 大字报 | 编辑杂志 | 数据信息图 |
向用户展示 3 个推荐风格,每个包含:
- 风格名 + 一句话描述
- 适用场景
- 色彩倾向
问用户:选哪个风格?或者你有自己想要的参考?
完整风格库: references/style-gallery.md
---
Step 2: 选择生成路径 ✅ 用户确认
根据内容特征推荐路径,向用户展示对比:
| Path A: HTML → 截图 | Path B: AI 生成 | |
|---|---|---|
| 文字准确度 | 100%(代码控制) | 中文可能出错(需验证) |
| 布局控制 | 像素级精确 | AI 自由发挥 |
| 视觉创意 | 中(靠设计能力) | 高(AI 有创造力) |
| API 成本 | 零(纯本地) | 每张消耗 Gemini API |
| 速度 | 快(几秒) | 慢(10-30秒/张) |
| 适合 | 文字多、数据多、清单、信息图 | 封面、氛围图、创意插画 |
| 可编辑性 | 改 HTML 重新截图即可 | 需要重新生成 |
| 深色模式 | CSS 直接控制配色 | 需在 prompt 中声明 |
⚠️ 花叔偏好:AI生成优先
HTML截图效果太平面、像PPT模板,缺少质感和设计感。AI生成的图片有丰富的视觉细节,品质远胜HTML。
默认走AI生成路径,只有「必须逐字精确的复杂数据表格」才用HTML兜底。
路径推荐规则
| 图片类型 | 推荐路径 | 理由 |
|---|---|---|
| 头条封面 | AI | 视觉冲击力强,质感好 |
| 正文氛围/场景图 | AI | 创意性强 |
| 正文信息图 | AI | AI能做出设计感的信息图 |
| 流程图/步骤图 | AI | AI能加入视觉层次 |
| 对比图 | AI | 视觉品质更高 |
| 精确数据表格(10+单元格) | HTML | 唯一需要HTML的场景:大量精确数字 |
默认推荐AI路径,不再逐次询问路径选择。
---
Step 3: 生成图片
Path A: HTML → Playwright 截图
3-A-1. 创建 HTML
根据选定风格和用户提供的内容,生成 HTML 文件。
HTML 模板要求:
- 画布尺寸:根据图片类型选择(封面 1800x766,正文宽图 1920x1080,正文方图 1440x1080)
- 字体:
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif - 深色模式友好:用 #F5F5F5 代替纯白,用 #1A1A2E 代替纯黑
- 封面安全区:核心信息集中在中央正方形区域(766x766)
封面大字报模板示例(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>正文信息图模板示例(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. 截图
npx playwright screenshot "file:///path/to/card.html" output.png \
--viewport-size=[宽],[高] --wait-for-timeout=1000- 封面:
--viewport-size=1800,766 - 正文宽图:
--viewport-size=1920,1080 - 正文方图:
--viewport-size=1440,1080
3-A-3. ✅ 预览确认
用 Read 工具向用户展示截图结果。
问用户:
- 文字内容对吗?
- 布局和配色满意吗?
- 封面的核心信息在安全区内吗?(封面图特有)
- 需要调整什么?
如需调整:修改 HTML → 重新截图 → 再次确认。(HTML 路径迭代成本极低)
---
Path B: AI 生成(Gemini 3 Pro Image)
3-B-1. 构建 Prompt
封面 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.正文 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 确认
向用户展示即将使用的 prompt,等待确认或修改。特别确认:
- 要渲染的文字内容是否正确
- 设计意图是否准确
- 是否有其他要求
3-B-3. 生成
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 头条封面--aspect wide→ 16:9 正文宽图(默认)--aspect standard→ 4:3 正文方图--aspect square→ 1:1 方图
多张图可并行生成(run_in_background=true)。
3-B-4. ✅ 预览确认
用 Read 工具向用户展示生成结果。
检查项: 1. 文字准确吗?(中文无乱码/错字) 2. 比例正确吗?(封面 2.35:1、正文 16:9 或 4:3) 3. 封面安全区:核心信息在中央正方形内?(封面特有) 4. 深色模式:是否避免了纯白底和纯黑底? 5. 风格满意吗?
问用户:满意 / 重新生成 / 调整 prompt?
---
Path C: 混合路径(全套配图推荐)
适用于全套配图:封面用 AI 生成(抓眼球),正文信息图用 HTML 渲染(信息精确),正文氛围图用 AI 生成。
执行顺序: 1. 先按 Path B 生成封面 → 用户确认 2. 从封面的配色/氛围提取一致的风格 3. 正文氛围图用 Path B → 用户确认 4. 正文信息图/数据图用 Path A → 用户确认
---
Step 4: 上传图床
python3 /Users/alchain/Documents/写作/tools/upload_image.py "[图片路径]"返回 ImgBB 永久链接。公众号文章必须使用网络链接,本地路径在发布后失效。
---
快速参考
封面安全区域
┌─────────────────────────────────────┐
│ │ 766x766 │ │
│ 装饰区 │ 安全区域 │ 装饰区 │ 1800 x 766
│ │ (核心) │ │
└─────────────────────────────────────┘
↑ 朋友圈裁切区域 ↑深色模式适配要点
- 底色用 #F5F5F5(浅灰)代替纯白
- 底色用 #1A1A2E(暗紫灰)代替纯黑
- 正文字色用 #595959 或 #3F3F3F,不用纯黑 #000000
- 避免阴影效果、白色边框
- 使用低饱和度配色
中文文字渲染(AI 路径特有)
- 封面标题 ≤ 10 字
- 正文图上文字 ≤ 20 字/行
- 信息图文字用 HTML 渲染更可靠
- 必须逐张验证
字体推荐(HTML 路径特有)
- 标题:
"PingFang SC"Bold /"Microsoft YaHei"Bold - 正文:
"PingFang SC"Regular - 商用安全替代:阿里巴巴普惠体、思源黑体
花叔科技账号配色
| 方案名 | 底色 | 主色 | 强调色 | 适用 | 深色模式 |
|---|---|---|---|---|---|
| 暖灰专业 | #F5F0EB | #D97706 | #4A90D9 | AI工具、分享 | 好 |
| 极简专业 | #F5F5F5 | #4A90D9 | #FF6B35 | 教程、对比 | 中 |
| 暗夜金 | #1A1A2E | #E2B714 | #FFFFFF | 产品发布 | 好 |
| 终端绿 | #1A1A1A | #00FF41 | #888888 | 编程相关 | 好 |
Golden Rules
- 封面核心信息放在中央正方形安全区
- 正文图用中间色调背景(适配深色模式)
- 信息图优先 HTML → 截图(文字精确)
- 氛围图优先 AI 生成(创意性强)
- 图片上传到图床获取永久链接
- 同一文章插图风格统一
- 每 800-1200 字配一张图
- 每个 H2 章节至少一张
配图位置策略
| 位置 | 必要性 | 类型 |
|---|---|---|
| 标题下方(封面) | 必须 | 封面图 / 氛围图 |
| 每个 H2 标题后 | 推荐 | 章节插图 |
| 数据/对比处 | 推荐 | 信息图 |
| 产品/工具介绍处 | 可选 | 截图 / AI 概念图 |
| 文末总结前 | 可选 | 收尾插图 |
决策流程图
用户需求 → Step 0 确定需求
↓
Step 1 选风格(展示3个选项)
↓
Step 2 默认AI生成(仅精确数据表格走HTML)
↓
Step 3 生成 → 预览 → 用户确认
├→ 满意 → Step 4 上传
├→ 文字渲染有误 → 该张改用HTML兜底
└→ 不满意 → 调整prompt重新生成相关 Skills
| Skill | 作用 |
|---|---|
xhs-image | 小红书配图(姊妹 skill) |
image-to-slides | PPT 配图(风格库来源) |
参考文件
references/style-gallery.md— 完整风格库与 prompt 模板references/design-guidelines.md— 公众号平台设计规范
---
花叔出品 | AI Native Coder · 独立开发者
公众号「花叔」| 30万+粉丝 | AI工具与效率提升
代表作:小猫补光灯(AppStore付费榜Top1)·《一本书玩转DeepSeek》
公众号平台设计规范
基于 2025-2026 调研数据。特别关注:封面安全区、深色模式、尺寸标准。
一、尺寸规范
封面图
| 用途 | 官方尺寸 | 比例 | 备注 |
|---|---|---|---|
| 头条封面 | 900 x 383 px | 2.35:1 | 信息流中展示,决定点击率 |
| 次条封面 | 200 x 200 px | 1:1 | 小方块展示 |
| 朋友圈裁切 | 383 x 383 px | 1:1 | 从封面中心裁切 |
⚠️ 关键发现:
- 微信官方封面标准是 900x383(2.35:1),不是常见误传的 16:9
- 分享到朋友圈时自动从大图中心裁切 383x383 正方形
- 因此封面设计必须确保核心信息在中央正方形区域内
生成建议:按 1800x766(2倍分辨率)生成,上传时微信自动压缩。
正文配图
| 用途 | 推荐宽度 | 格式 | 文件大小 |
|---|---|---|---|
| 标准正文图 | 1080 px | PNG-24 | < 500KB |
| 备选 | 900 px | JPG | < 300KB |
| 信息图/长图 | 800-1080 px | PNG | < 2MB |
| GIF | 640 px | GIF | < 5MB |
限制:
- 单图像素上限:长 x 宽 < 600万像素
- 单图文件大小 < 10MB
- GIF:宽度 640px,帧率 12-20fps,帧数 < 300
正文图比例选择
| 比例 | 尺寸 | 适用 |
|---|---|---|
| 16:9 | 1920 x 1080 | 宽幅场景、产品展示、氛围图 |
| 4:3 | 1440 x 1080 | 信息图、数据对比、内容密集图 |
| 1:1 | 1080 x 1080 | 人物头像、产品图 |
| 自由 | 1080 x N | 长信息图、流程图 |
---
二、封面图设计要点
安全区域图解
┌─────────────────────────────────────┐
│ │ 383x383 │ │
│ 装饰区 │ 安全区域 │ 装饰区 │ 900 x 383
│ │ (核心) │ │
└─────────────────────────────────────┘
↑ 朋友圈裁切区域 ↑- 安全区域(中央 383x383):放标题、核心视觉元素
- 两侧装饰区:放辅助图形、渐变、纹理,不放关键文字
- 安全区域内的标题建议 ≤ 10 字
高点击率封面套路
| 类型 | 适用 | 技巧 |
|---|---|---|
| 放大关键词 | 评测、工具推荐 | 核心词用超大字号 |
| 人物/表情 | 个人 IP、访谈 | 真人或漫画角色表情 |
| 悬念设计 | 观点、发现 | "我发现了一个秘密" |
| 反差配色 | 对比、PK | 红蓝/黑白对比色块 |
| 数字突出 | 数据、排名 | "Top 5"、"提升300%" |
| 品牌一致 | 日常更新 | 固定模板 + 变量内容 |
科技类封面最佳实践
- 深色背景 + 亮色点缀 + 产品截图/数据对比
- 避免纯文字(没有视觉锚点)
- 避免过于花哨的装饰(分散注意力)
- 标题做到「看完标题就想点进来」
---
三、深色模式适配(重要!)
为什么这很重要
微信从 2020 年开始支持深色模式,估计 30-40% 用户使用。图片如果没有考虑深色模式,体验会很差。
核心规则
| 规则 | 说明 |
|---|---|
| 避免纯白底 | #FFFFFF 在深色模式下极其刺眼 → 改用 #F5F5F5 或 #F0F4FF |
| 避免纯黑底 | #000000 会与深色背景融合,图片「消失」→ 改用 #0D1B2A 或 #1A1A2E |
| 避免阴影 | 深色模式下阴影变成发光体 |
| 避免白色边框 | 会非常突兀 |
| 用低饱和度 | 高饱和色在深色背景上更刺激 |
安全配色表
| 用途 | 亮色模式安全值 | 深色模式也安全 |
|---|---|---|
| 浅底背景 | #F5F5F5、#F0F4FF、#F5F0EB | 是 |
| 深底背景 | #2D2D2D、#1A1A2E、#1E293B | 是 |
| 正文字色 | #595959、#3F3F3F | 是(不用纯黑 #000) |
| 强调色 | #2563EB、#D97706、#10B981 | 是(中饱和度) |
最佳策略
- 深色底图片天然兼容深色模式
- 浅色底用灰白(#F5F5F5)代替纯白
- 信息图如果无法避免白底,可以加 1px #E5E5E5 边框
---
四、配色方案
科技/AI 内容
| 方案 | 底色 | 主色 | 强调色 | 深色模式 | 适用 |
|---|---|---|---|---|---|
| 暖灰专业 | #F5F0EB | #D97706 | #4A90D9 | 好 | AI工具、分享 |
| 暗夜金 | #1A1A2E | #E2B714 | #FFFFFF | 好 | 产品发布、对比 |
| 终端绿 | #0C0C0C→#1A1A1A | #00FF41 | #888888 | 好 | 编程、代码相关 |
| 柔灰蓝 | #F0F4FF | #2563EB | #10B981 | 中 | 教程、轻松科普 |
| 暖灰 | #F5F0EB | #D97706 | #4A90D9 | 好 | 个人故事、人物 |
| 莫兰迪灰 | #E8E4E0 | #7C8F8C | #C17851 | 好 | 深度文章、观察 |
2025-2026 设计趋势
Bento Grid 便当盒布局
- 模块化卡片排列
- 适合信息密集的正文插图
- Prompt 关键词:
bento grid layout, modular cards, structured modules
Glassmorphism 玻璃拟态
- 毛玻璃效果 + 半透明色块
- 适合科技封面
- Prompt 关键词:
glassmorphism effect, frosted glass panels, translucent layers
哑光宝石色调
- 深蓝、翡翠绿、酒红的低饱和版本
- 高端感强
- Prompt 关键词:
matte jewel tones, deep sapphire, emerald, burgundy
微妙渐变
- 非彩虹渐变,而是同色系微妙过渡
- Prompt 关键词:
subtle gradient, monochromatic transition, atmospheric depth
---
五、排版规范
封面文字
| 元素 | 建议 |
|---|---|
| 标题字数 | ≤ 10 字(AI 渲染可靠范围) |
| 标题字号 | 封面宽度的 5-8% |
| 副标题 | ≤ 15 字,可选 |
| 字体选择 | 粗体/Bold(细体在小尺寸下看不清) |
正文图文字
- 正文图上的文字尽量少(正文已有充分文字)
- 如果有文字,每行 ≤ 20 字
- 信息图文字推荐 HTML 渲染(更可靠)
AI 中文渲染限制
- 标题 ≤ 10 字最可靠(比小红书的 7 字限制宽松,因为封面更大)
- 单行 ≤ 20 字
- 生僻字/低频字容易出错
- 数字和英文比中文渲染更稳定
- 每张图必须人工验证
---
六、配图位置策略
标准文章配图模板
[封面图 - 头条封面 900x383]
# 文章标题
[引言段落...]
## 第一部分标题
[正文...]
[正文插图 1 - 16:9 或 4:3]
[正文...]
## 第二部分标题
[正文...]
[正文插图 2 - 信息图/对比图]
[正文...]
## 第三部分标题
[正文...]
[正文插图 3 - 截图/示例图]
[正文...]
## 总结
[正文...]
[收尾插图 - 可选]配图密度建议
- 每 800-1200 字配一张图
- 每个 H2 章节至少一张
- 不要连续两段纯文字超过 500 字
- 但也不要过度配图(打断阅读节奏)
---
七、图片格式与压缩
| 格式 | 适用 | 优点 | 缺点 |
|---|---|---|---|
| PNG-24 | 截图、信息图、文字多的图 | 无损、文字清晰 | 文件大 |
| JPG | 照片、氛围图 | 文件小 | 有损压缩 |
| PNG(透明底) | 需要透明背景的图标/插画 | 深色模式友好 | 文件大 |
| GIF | 动图、短操作演示 | 动态展示 | 色彩有限 |
压缩建议
- 目标文件大小 < 500KB
- PNG 可以用 TinyPNG 压缩
- 不要过度压缩导致模糊(尤其是有文字的图)
---
八、NBP 生成注意事项
长宽比控制
- Gemini 3 Pro Image 通过 prompt 描述控制长宽比
- 封面必须明确写:
2.35:1 ultra-wide landscape, 1800x766 pixels - 正文 16:9 写:
16:9 landscape, 1920x1080 pixels - 正文 4:3 写:
4:3 landscape, 1440x1080 pixels - 使用
--resolution 2K确保清晰 - AI 偶尔忽略长宽比 → 检查后重新生成
封面安全区域提示
- 在 prompt 中加入:
SAFE ZONE: The center square area must contain all critical text and visual elements - 这能提高 AI 将核心内容放在中央的概率(但不是 100%)
深色模式在 Prompt 中的体现
- 正文图加入:
DARK MODE: Use medium-tone backgrounds, avoid pure white (#FFFFFF) and pure black (#000000) - 或直接指定具体底色(#F5F5F5、#0D1B2A 等)
公众号配图风格库
为微信公众号文章优化的风格库。核心原则:描述情绪和美学参考,不要微操布局。 特别注意深色模式兼容性。
第一梯队:强烈推荐
1. 极简专业 Clean Professional
一句话:白底 + 结构化布局 + 科技蓝,专业可信。
封面 Base Style:
VISUAL REFERENCE: Apple product page meets Monocle editorial — clean, authoritative, premium.
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: Soft light gray (#F5F5F5) background (NOT pure white), tech blue (#2563EB) accent, charcoal (#374151) text. Clean and breathable.正文 Base Style:
VISUAL REFERENCE: Apple product page meets Monocle editorial.
CANVAS: 16:9 landscape, 1920x1080 pixels, high quality rendering.
COLOR SYSTEM: Soft light gray (#F5F5F5) background, tech blue (#2563EB) accent. Information hierarchy is king.
DARK MODE: Use #F5F5F5 background instead of pure white for WeChat dark mode compatibility.适用:教程、指南、工具对比、技术分享 深色模式:用 #F5F5F5 而非 #FFFFFF 可以缓解,但仍偏亮
---
2. 编辑杂志 Editorial Magazine
一句话:Kinfolk × Wired,高级感编辑排版。
封面 Base Style:
VISUAL REFERENCE: Kinfolk magazine cover meets Wired feature spread — sophisticated editorial design.
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: Muted sophisticated palette — warm cream, soft charcoal, one distinctive accent color. Feels curated and expensive.正文 Base Style:
VISUAL REFERENCE: Long-form editorial feature from Wired or The Atlantic.
CANVAS: 4:3 landscape, 1440x1080 pixels, high quality rendering.
COLOR SYSTEM: Warm neutral background (#F5F0EB), dark charcoal (#2D2D2D) text areas, one muted accent. Premium editorial feel.适用:深度分析、产品发布、行业观察、人物故事 深色模式:暖灰底天然友好
---
3. Snoopy 温暖漫画
一句话:Peanuts 风格,温暖有差异化,适合个人 IP。
封面 Base Style:
VISUAL REFERENCE: Charles Schulz Peanuts comic strip — warm, philosophical, charming.
Characters include round-headed kids, a lovable beagle dog, and a small yellow bird.
CANVAS: 2.35:1 ultra-wide landscape, 1800x766 pixels, high quality rendering.
SAFE ZONE: Center square (766x766) contains characters and title.
COLOR SYSTEM: Warm cream/newspaper tone background, soft muted pastels, warm ink lines. Sunday morning comic page feeling.正文 Base Style:
VISUAL REFERENCE: Peanuts comic strip — warm, philosophical, charming.
CANVAS: 16:9 landscape, 1920x1080 pixels, high quality rendering.
COLOR SYSTEM: Warm cream background, soft pastels, warm ink lines. Cozy and inviting.适用:个人 IP、品牌故事、教育培训、温暖话题 深色模式:暖色调在深色模式下观感良好 详细指南:image-to-slides/references/proven-styles-snoopy.md
---
4. 大字报 Bold Statement
一句话:文字即画面,观点输出利器。
封面 Base Style:
VISUAL REFERENCE: Brutalist editorial magazine cover — text as primary visual element.
CANVAS: 2.35:1 ultra-wide landscape, 1800x766 pixels, high quality rendering.
SAFE ZONE: Title must be centered in the 766x766 safe zone.
COLOR SYSTEM: Stark high contrast — dark background with light text, or vice versa. Minimal decoration.正文 Base Style:
VISUAL REFERENCE: Brutalist editorial statement, typography-driven design.
CANVAS: 16:9 landscape, 1920x1080 pixels, high quality rendering.
COLOR SYSTEM: High contrast. Text is the hero element. Minimal background decoration.适用:观点文、争议话题、金句、行业呼吁 深色模式:暗色底版本天然兼容
---
第二梯队:特定场景推荐
5. 数据信息图 Data Infographic
一句话:结构化数据展示,正文插图首选。
正文 Base Style:
VISUAL REFERENCE: The Economist data visualization meets Information is Beautiful.
CANVAS: 4:3 landscape, 1440x1080 pixels, high quality rendering.
COLOR SYSTEM: Clean neutral background, one primary data color, one accent for highlights. Information clarity above all.适用:对比分析、数据展示、流程说明 注意:文字多的信息图推荐用 HTML → Playwright 截图路径
---
6. 手绘白板 Whiteboard Sketch
正文 Base Style:
VISUAL REFERENCE: xkcd meets professor's whiteboard — extreme minimalism, humor, insight.
CANVAS: 16:9 landscape, 1920x1080 pixels, high quality rendering.
COLOR SYSTEM: White background, black ink, ONE accent color (red or blue). 85% white space.适用:技术解释、概念科普、架构图、流程图
---
7. 温暖叙事 Warm Narrative
正文 Base Style:
VISUAL REFERENCE: Airbnb brand presentation meets Mailchimp editorial — approachable, human, warm.
CANVAS: 16:9 landscape, 1920x1080 pixels, high quality rendering.
COLOR SYSTEM: Warm cream (#FDF6EC) background, coral (#E17055) accent, charcoal text. People-centric imagery.适用:个人故事、用户案例、品牌内容
---
第三梯队:偶尔使用
| 风格 | 适用场景 | 封面/正文 |
|---|---|---|
| 苏联构成主义 | 产品发布、keynote 风 | 封面 |
| 新波普 Neo-Pop | 年轻受众、潮流科技 | 封面 |
| 学習漫画 Manga | 教程、培训 | 正文 |
| 清线 Ligne Claire | 流程说明、产品图 | 正文 |
| 等轴测 Isometric | 技术架构、系统图 | 正文 |
---
封面 vs 正文的风格搭配
同一篇文章中,封面和正文可以用不同但互补的风格:
| 封面风格 | 正文搭配 | 效果 |
|---|---|---|
| 极简专业 | 手绘白板 + 信息图 | 专业中有趣味 |
| 编辑杂志 | 温暖叙事 + 信息图 | 高级深度感 |
| Snoopy 漫画 | Snoopy 漫画(统一) | 强 IP 一致性 |
| 大字报 | 数据信息图 + 截图 | 冲击力 + 干货 |
---
公众号特有的 Prompt 注意事项
封面图专属
- 必须声明
2.35:1 ultra-wide landscape - 必须提及
center square safe zone - 标题放在中央区域(朋友圈裁切为正方形)
- 两侧可有装饰但不能放文字
正文图专属
- 声明
DARK MODE: Use medium-tone backgrounds - 避免纯白 #FFFFFF 和纯黑 #000000
- 正文图文字可以少或没有(配合文章正文)
- 氛围/情感图 > 信息图(正文已有足够文字)
信息图专属
- 推荐 HTML → Playwright 路径(文字精确)
- AI 生成适合没有或少量文字的氛围图
- 4:3 比例更适合信息密集的内容
- 16:9 适合宽幅场景/全景
反模式
| 反模式 | 为什么不好 | 替代方案 |
|---|---|---|
| 纯白底正文图 | 深色模式下刺眼 | 用 #F5F5F5 或 #F0F4FF |
| 纯黑底封面 | 深色模式下融入背景消失 | 用 #1A1A2E 或 #2D2D2D |
| 封面边缘放标题 | 朋友圈裁切丢失 | 标题居中 |
| 一篇文章 3 种风格 | 视觉混乱 | 封面 + 正文最多 2 种互补风格 |
| "professional modern clean" | AI 生成毫无特色 | 引用具体出版物/品牌美学 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "google-genai>=1.0.0",
# "pillow>=10.0.0",
# ]
# ///
"""
Generate images for WeChat Official Account (公众号) articles using Gemini 3 Pro Image API.
Supports multiple aspect ratios:
--aspect cover → 2.35:1 (900x383, 头条封面)
--aspect wide → 16:9 (1920x1080, 正文宽图)
--aspect standard → 4:3 (1440x1080, 正文方图)
--aspect square → 1:1 (1080x1080, 方图)
Default: 2K resolution.
Usage:
uv run generate_image.py --prompt "description" --filename "output.png" [--aspect cover|wide|standard|square] [--resolution 1K|2K|4K]
uv run generate_image.py --prompt "edit instructions" --filename "output.png" --input-image "input.png"
"""
import argparse
import os
import sys
from pathlib import Path
# Aspect ratio presets for WeChat
ASPECT_PRESETS = {
"cover": {"ratio": "2.35:1", "pixels": "1800x766", "desc": "头条封面 ultra-wide landscape"},
"wide": {"ratio": "16:9", "pixels": "1920x1080", "desc": "正文宽图 landscape"},
"standard": {"ratio": "4:3", "pixels": "1440x1080", "desc": "正文方图 landscape"},
"square": {"ratio": "1:1", "pixels": "1080x1080", "desc": "方图"},
}
def get_api_key(provided_key: str | None) -> str | None:
"""Get API key from argument first, then environment."""
if provided_key:
return provided_key
return os.environ.get("GEMINI_API_KEY")
def main():
parser = argparse.ArgumentParser(
description="Generate images for WeChat (公众号) using Gemini 3 Pro Image"
)
parser.add_argument(
"--prompt", "-p",
required=True,
help="Image description/prompt"
)
parser.add_argument(
"--filename", "-f",
required=True,
help="Output filename (e.g., wechat-cover.png)"
)
parser.add_argument(
"--input-image", "-i",
help="Optional input image path for editing/modification"
)
parser.add_argument(
"--aspect", "-a",
choices=["cover", "wide", "standard", "square"],
default="wide",
help="Aspect ratio preset: cover (2.35:1), wide (16:9, default), standard (4:3), square (1:1)"
)
parser.add_argument(
"--resolution", "-r",
choices=["1K", "2K", "4K"],
default="2K",
help="Output resolution: 1K, 2K (default), or 4K"
)
parser.add_argument(
"--api-key", "-k",
help="Gemini API key (overrides GEMINI_API_KEY env var)"
)
args = parser.parse_args()
# Get API key
api_key = get_api_key(args.api_key)
if not api_key:
print("Error: No API key provided.", file=sys.stderr)
print("Please either:", file=sys.stderr)
print(" 1. Provide --api-key argument", file=sys.stderr)
print(" 2. Set GEMINI_API_KEY environment variable", file=sys.stderr)
sys.exit(1)
# Import here after checking API key to avoid slow import on error
from google import genai
from google.genai import types
from PIL import Image as PILImage
# Initialise client
client = genai.Client(api_key=api_key)
# Set up output path
output_path = Path(args.filename)
output_path.parent.mkdir(parents=True, exist_ok=True)
# Get aspect ratio info
aspect = ASPECT_PRESETS[args.aspect]
# Load input image if provided
input_image = None
output_resolution = args.resolution
if args.input_image:
try:
input_image = PILImage.open(args.input_image)
print(f"Loaded input image: {args.input_image}")
if args.resolution == "2K": # Default value
width, height = input_image.size
max_dim = max(width, height)
if max_dim >= 3000:
output_resolution = "4K"
elif max_dim >= 1500:
output_resolution = "2K"
else:
output_resolution = "1K"
print(f"Auto-detected resolution: {output_resolution} (from input {width}x{height})")
except Exception as e:
print(f"Error loading input image: {e}", file=sys.stderr)
sys.exit(1)
# Build contents (image first if editing, prompt only if generating)
if input_image:
contents = [input_image, args.prompt]
print(f"Editing image with resolution {output_resolution}...")
else:
contents = args.prompt
print(f"Generating WeChat image ({aspect['desc']}, {aspect['ratio']}) with resolution {output_resolution}...")
try:
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=contents,
config=types.GenerateContentConfig(
response_modalities=["TEXT", "IMAGE"],
image_config=types.ImageConfig(
image_size=output_resolution
)
)
)
# Process response and convert to PNG
image_saved = False
for part in response.parts:
if part.text is not None:
print(f"Model response: {part.text}")
elif part.inline_data is not None:
from io import BytesIO
image_data = part.inline_data.data
if isinstance(image_data, str):
import base64
image_data = base64.b64decode(image_data)
image = PILImage.open(BytesIO(image_data))
# Ensure RGB mode for PNG
if image.mode == 'RGBA':
rgb_image = PILImage.new('RGB', image.size, (255, 255, 255))
rgb_image.paste(image, mask=image.split()[3])
rgb_image.save(str(output_path), 'PNG')
elif image.mode == 'RGB':
image.save(str(output_path), 'PNG')
else:
image.convert('RGB').save(str(output_path), 'PNG')
image_saved = True
if image_saved:
full_path = output_path.resolve()
print(f"\nImage saved: {full_path}")
# Report image dimensions and check aspect ratio
saved_img = PILImage.open(str(output_path))
w, h = saved_img.size
actual_ratio = w / h
# Calculate expected ratio from preset
ratio_parts = aspect["ratio"].split(":")
expected_ratio = float(ratio_parts[0]) / float(ratio_parts[1])
print(f"Dimensions: {w}x{h} (ratio: {actual_ratio:.2f}, expected {aspect['ratio']} = {expected_ratio:.2f})")
if abs(actual_ratio - expected_ratio) > 0.15:
print(f"⚠️ Warning: Image ratio {actual_ratio:.2f} differs from expected {aspect['ratio']} ({expected_ratio:.2f}). Consider regenerating.")
# Special warning for cover safe zone
if args.aspect == "cover":
print(f"📌 Cover safe zone reminder: Core content must be within the center {h}x{h} square area for WeChat Moments cropping.")
else:
print("Error: No image was generated in the response.", file=sys.stderr)
sys.exit(1)
except Exception as e:
print(f"Error generating image: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
FAQ
What dimensions does huashu-wechat-image use for WeChat covers?
huashu-wechat-image generates headline covers at 1800×766 pixels (2.35:1 ratio), setting Playwright --viewport-size=1800,766 and declaring the ultra-wide landscape aspect in AI prompts.
Can huashu-wechat-image skip the design proposal step?
No. huashu-wechat-image mandates understanding content, presenting two to three design directions, user selection, generation, preview confirmation, and upload—never direct image output.