
Huashu Xhs Image
- 636 installs
- 1.3k repo stars
- Updated August 2, 2026
- alchaincyf/huashu-skills
huashu-xhs-image is a Claude Code skill that generates on-brand Xiaohongshu cover and carousel images for developers and creators who need proposal-first AI visuals instead of generic template output.
About
huashu-xhs-image is a Xiaohongshu (Little Red Book) image workflow skill that defaults to Gemini AI generation for note covers and carousels, using HTML screenshots only as a fallback for precise data tables. The skill enforces a proposal-first pipeline: understand content, present 2-3 design directions, wait for user selection, then generate and preview before upload—never skip straight to images. huashu-xhs-image encodes a design taste profile favoring warm paper textures, handwritten fonts, hero-sized keywords, and mobile vertical layouts while rejecting cyber-neon palettes, excessive whitespace, and flat HTML-slide aesthetics. Developers and content engineers reach for huashu-xhs-image when automating 小红书配图, 封面, or carousel assets with agent-guided brand consistency rather than one-shot generic AI art.
- Enforces strict 2-3 direction design proposal workflow before any image generation
- Applies Huashu’s verified aesthetic system: warm paper textures, handwritten calligraphy, hero keywords, and structured
- Defaults to Gemini image generation with HTML canvas fallback only for precise data tables
- Outputs 1080x1440 px (3:4) images optimized for mobile-first Xiaohongshu vertical feed
- Prevents aesthetic anti-patterns: no cyber-neon, no deep blue backgrounds, no watermarks, no excessive whitespace
Huashu Xhs Image by the numbers
- 636 all-time installs (skills.sh)
- Ranked #361 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-xhs-imageAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 636 |
|---|---|
| repo stars | ★ 1.3k |
| Last updated | August 2, 2026 |
| Repository | alchaincyf/huashu-skills ↗ |
How do you generate on-brand Xiaohongshu note images?
Generate high-quality, on-brand cover and carousel images for Xiaohongshu (Little Red Book) notes without jumping straight into generic AI output.
Who is it for?
Developers automating Xiaohongshu note visuals who need proposal-first Gemini generation with warm, mobile-first design rules.
Skip if: English-only blog hero images or Western social formats without Xiaohongshu vertical layout constraints.
When should I use this skill?
User mentions 小红书配图, 小红书封面, 笔记配图, or Xiaohongshu carousel/cover image generation.
What you get
Approved design proposals, Gemini-generated vertical cover/carousel PNGs, and preview-confirmed Xiaohongshu note assets.
- design proposals
- cover PNG
- carousel image set
By the numbers
- Design proposal step presents 2-3 directions before image generation
- Documented style matrix covers multiple verified visual style categories
Files
小红书配图工作流
⚠️ 核心原则:先提案,后生成
绝对不能跳过设计提案直接出图。 正确流程:
理解内容 → 设计提案(2-3个方向)→ 用户选择 → 生成 → 预览确认 → 上传---
花叔设计审美画像
喜欢的
- 质感和温度 — 纸张褶皱、手写笔触、印章、胶带等有机元素
- 手绘/书法字体 — 笔记感、个人分享场景尤其适合
- 文字撑满画面 — 小红书是手机竖屏,文字要大到一眼看清
- 核心元素强化 — 关键数字/关键词做视觉hero(放大3倍、变色、加装饰)
- 结构清晰 — 主标题 > 副标题 > 列表,层次分明
- 暖色调 — 奶油色、暖橙、暖金表现好
不喜欢的
- HTML截图 — 太平面、像PPT模板、没有灵魂(仅精确数据表格兜底)
- 赛博霓虹/深蓝底 — #0D1117等深蓝色底属于审美禁区
- 署名/水印 — 封面图不出现「花生」「花叔」「@花生」
- 过度留白 — 宁可满一点,不要空荡荡
验证过的好风格
| 风格 | 表现 | 适用 |
|---|---|---|
| 手绘笔记(暖色纸张+书法字+手绘图标) | ⭐⭐⭐⭐⭐ | 教程、干货、个人分享 |
| 暗金海报(深色底+金色大字) | ⭐⭐⭐⭐ | 产品发布、震撼标题(需搭配好内容) |
| 极简信息图(浅底+大数字+简洁层次) | ⭐⭐⭐⭐ | 数据驱动、对比 |
---
核心参数
| 参数 | 值 |
|---|---|
| 标准尺寸 | 1080 x 1440 px (3:4) |
| AI 生成分辨率 | --resolution 2K |
| AI Prompt 长宽比声明 | 3:4 portrait aspect ratio, 1080x1440 pixels |
| HTML viewport(兜底用) | --viewport-size=1080,1440 |
---
Step 1: 理解内容
读取用户提供的内容,快速提炼:
- 主题:这篇讲什么?
- 核心关键词:哪些词/数字需要做视觉hero?
- 情绪/调性:悬念?干货?温暖?震撼?
- 图片数量和类型:单封面 / 轮播套图 / 信息图?
不需要向用户展示分析结果,直接进入Step 2。
---
Step 2: 设计提案 ✅ 必须等用户选择
这是整个流程最关键的一步。禁止跳过。
提案格式
向用户展示 2-3个设计方向,每个方向包含:
### 方向A:[风格名]
- 视觉风格:[一句话描述画面感,如"暖色笔记本纸张+毛笔书法大字+手绘小图标"]
- 色彩:[底色 + 主色 + 强调色]
- 文案布局:[哪些文字放大做hero、哪些做副标题、整体排列方式]
- 情绪:[用户看到后的第一感受]提案原则
1. 每个方向要有明确差异(风格、情绪、色彩至少有一个完全不同) 2. 标注推荐(基于内容特征说明为什么推荐某个方向) 3. 文案要具体(不是"标题放大",而是「"28"做200px的hero元素,橙色强调」) 4. 不要超过3个方向(选择太多反而难选)
提案示例
方向A:手绘笔记风(推荐)
- 视觉风格:奶油色方格纸底 + 毛笔书法大标题 + 手绘科技小图标
- 色彩:底色#FDF6EC + 主色#D97706(暖橙)+ 强调圈线
- 文案布局:「阿里C4楼」「来了一群广东人」撑满上半区做hero,「AI开源冠军」橙色高亮做视觉锚点,右下角「千问APP」印章
- 情绪:亲切、真实、像朋友分享内幕
>
方向B:暗金揭秘风
- 视觉风格:深色磨砂底 + 金色大字 + 徽章装饰
- 色彩:底色#1A1A1A + 主色#E2B714(金)+ 白色辅助
- 文案布局:「全球AI开源冠军」金色巨字撑满画面,上方「大厂内幕」金色徽章,下方副标题白色
- 情绪:震撼、内幕、有分量感
等用户选择后才进入 Step 3。 用户可能会:
- 直接选一个 → 进入生成
- 要求混合/调整 → 修改方向后再确认
- 都不满意 → 追问偏好后重新提案
---
Step 3: 生成图片
构建 Prompt
基于用户选择的方向,构建完整prompt。
Prompt 模板:
Create a [style] cover for a Xiaohongshu post. 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
VISUAL STYLE: [从提案中的视觉风格描述展开]
COLOR PALETTE: [具体色彩描述]
TYPOGRAPHY: text fills most of the canvas, oversized bold typography, clear visual hierarchy.
TEXT TO RENDER:
- [主标题 — hero元素,视觉dominant]
- [副标题]
- [其他文字元素]
The word/number "[核心关键词]" is visually dominant, 3x larger than other text, with decorative emphasis.
IMPORTANT: Do NOT include any personal signature, watermark, or author name like "花生" or "花叔".
[1-2句画面情绪描述]花叔偏好 Prompt 关键词(按需加入):
- 文字大 →
text fills most of the canvas, oversized bold typography - 核心强化 →
the word/number "XX" is visually dominant, 3x larger than other text, with decorative emphasis - 手写体 →
handwritten style Chinese text / brush calligraphy lettering - 纸张质感 →
warm cream paper texture with subtle grid lines, notebook page feel - 结构清晰 →
clear visual hierarchy with distinct heading, subheading, and list levels - 无署名 →
Do NOT include any personal signature, watermark, or author name
两条生成路径(每次都出)
| 路径 | 工具 | 优势 | 劣势 | 成本 |
|---|---|---|---|---|
| AI生成 | Gemini nano-banana-pro | 质感好、有温度、视觉丰富 | 中文可能渲染错误 | 有API费用 |
| HTML截图 | Playwright | 文字100%精确、零成本、可批量 | 偏平面、缺少质感 | 免费 |
每次两条路径都出,方便用户对比选择。 HTML零成本,可以每个方向多出几种变体(配色/布局),给用户更多选择空间。AI路径每个方向出1张即可。
文件组织规范(必遵守)
多版本生成时,所有相关文件(png + html源文件)放在同一个子文件夹内:
文章所在目录/
├── 文章.md
└── [文章简称]-小红书配图/ ← 子文件夹
├── A-笔记风-AI.png
├── A1-笔记风-HTML-暖色.png
├── A1-笔记风-HTML-暖色.html
├── B-报纸风-AI.png
└── ...命名规则:[方向字母][变体序号]-[风格中文名]-[路径AI/HTML]-[变体描述].png
- 方向字母:A/B/C(对应设计提案的方向)
- AI路径无序号:
A-笔记风-AI.png - HTML变体带序号:
A1-笔记风-HTML-暖色.png、A2-笔记风-HTML-绿色.png - 文件夹名用文章关键词:
[关键词]-小红书配图/
AI生成命令
export $(grep GEMINI_API_KEY ~/.claude/.env) && \
uv run /Users/alchain/Documents/写作/.claude/skills/xhs-image/scripts/generate_image.py \
--prompt "[完整prompt]" \
--filename "[方向]-[风格]-AI.png" \
--resolution 2K生成后移动到配图子文件夹内。套图可并行生成(run_in_background=true)。
---
Step 4: 预览确认
浏览器预览(必做)
生成完成后,用 open 命令打开所有图片,方便用户并排对比:
open "[图片路径1]" "[图片路径2]" "[图片路径3]"内联预览
同时用 Read 工具在终端中展示生成结果。
基础检查项: 1. 中文文字渲染正确吗? 2. 比例是3:4竖版吗? 3. 风格符合选定方向吗? 4. 没有出现署名/水印吗?
设计审查(必做)
对每张图从两个维度评分(10分制),并给出优化方向:
| 维度 | 评判标准 |
|---|---|
| 设计评分 | 视觉层次、排版、色彩搭配、质感、创意 |
| 小红书吸引力 | 信息流中是否抢眼、文字是否够大、信息密度、情绪传达、是否引发好奇 |
审查输出格式:
- 每张图:综合评分 + 1句核心评价 + 1条优化方向
- 最后给出总结排名表,标注推荐
- 用户可自行决定是否采纳优化建议
用户反馈处理:
- 满意 → Step 5 上传
- 文字有误 → 该张改用HTML兜底渲染
- 风格不对 → 调整prompt重新生成
- 大改方向 → 回到Step 2重新提案
---
Step 5: 上传图床
python3 /Users/alchain/Documents/写作/tools/upload_image.py "[图片路径]"返回 ImgBB 永久链接。
---
HTML截图路径(AI文字渲染失败、精确数据表格、或用户要求对比时使用)
npx playwright screenshot "file:///path/to/card.html" output.png \
--viewport-size=1080,1440 --wait-for-timeout=1000HTML模板要求:
- 画布:
width: 1080px; height: 1440px - 字体:
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif - 安全区:上下各 80px、左右各 60px
---
快速参考
中文文字渲染限制(AI路径)
- 主标题 ≤ 7 字
- 副标题 ≤ 15 字
- 正文每行 ≤ 20 字
- 必须逐张验证
花叔科技账号配色
| 方案名 | 底色 | 主色 | 强调色 | 适用 |
|---|---|---|---|---|
| 暖灰专业 | #F5F0EB | #D97706 | #4A90D9 | AI工具、分享 |
| 极简专业 | #F5F5F5 | #4A90D9 | #FF6B35 | 教程、对比 |
| 暗夜金 | #1A1A2E | #E2B714 | #FFFFFF | 产品发布 |
| 终端绿 | #1A1A1A | #00FF41 | #888888 | 编程相关 |
Golden Rules
- 标题大、粗、醒目(占画面 30-50%)
- 核心数字/关键词做视觉强化(放大、变色、加装饰)
- 封面信息量大 → 引发好奇
- 套图风格统一
- 竖版 3:4,充分利用屏幕空间
- 不加署名/水印
---
相关 Skills
| Skill | 作用 |
|---|---|
wechat-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 调研数据,针对小红书平台的图片设计规范。
一、尺寸规范
推荐尺寸
| 比例 | 尺寸 | 用途 | 优先级 |
|---|---|---|---|
| 3:4 | 1080 x 1440 px | 标准笔记图(首选) | 最高 |
| 3:4 高清 | 1242 x 1660 px | 高清版本 | 高 |
| 1:1 | 1080 x 1080 px | 商品主图 | 中 |
| 16:9 | 1080 x 608 px | 横版(不推荐) | 低 |
平台限制
- 最大分辨率:1280 x 1706 px
- 最小分辨率:300 x 600 px
- 单篇笔记只支持一种比例,不能混用
- 图片数量:1-18张(推荐 6-9 张)
为什么首选 3:4
- 信息流中占屏面积比横版大 40%
- 更多展示空间 = 更多信息 = 更高停留
- 竖版是小红书原生阅读体验
---
二、封面图设计要点
六大高互动封面类型
| 类型 | 特点 | 适合 | 互动率 |
|---|---|---|---|
| 纯文字大字报 | 文字占 70%+,高对比 | 观点、金句 | 极高 |
| 数据截图+文字 | 真实截图+标注 | 评测、对比 | 高 |
| 人物+文字 | 表情包/人像+标题 | 个人IP | 高 |
| 清单/列表 | 序号+条目,一目了然 | 干货、推荐 | 高 |
| 对比图 | 左右/前后对比 | before/after | 中高 |
| 信息图 | 结构化数据展示 | 科普、分析 | 中 |
封面设计黄金法则
1. 3秒法则 — 用户在信息流中只看3秒决定是否点击 2. 缩略图测试 — 标题在 iPhone 信息流缩略图(约 170x227 px)下是否可读 3. 信息前置 — 核心信息放在图片上半部分(下方会被标题文字遮挡) 4. 对比反差 — 颜色/大小/内容的反差是最有效的吸引策略 5. 避免模板感 — 2025年起,千篇一律的 Canva 模板互动率持续下降
---
三、排版规范
文字层级
| 层级 | 字号范围 | 占比 | 用途 |
|---|---|---|---|
| 主标题 | 80-120px | 30-50% | 核心信息 |
| 副标题 | 40-60px | 10-20% | 补充说明 |
| 正文 | 28-36px | 20-30% | 详细内容 |
| 标注 | 20-24px | < 10% | 来源/备注 |
中文排版要点
- 主标题 3-7 字,不超过 10 字
- 知识类封面:文字应占页面 60-70% 空间
- 使用 3-4 种字号创造层级感
- 行间距 1.5-1.8 倍(比默认宽松)
- 字间距适当加大(中文默认间距偏紧)
安全区域
- 上下各留 80px 安全边距
- 左右各留 60px 安全边距
- 底部 120px 会被标题/用户名遮挡,不放重要信息
---
四、配色指南
科技/AI 内容推荐配色
| 方案 | 底色 | 主色 | 强调色 | 情绪 |
|---|---|---|---|---|
| 暖灰专业 | #F5F0EB | #D97706 | #4A90D9 | 温暖、专业 |
| 极简专业 | #F5F5F5 | #4A90D9 | #FF6B35 | 专业、可信 |
| 暗夜金 | #1A1A2E | #E2B714 | #FFFFFF | 高端、权威 |
| 终端绿 | #1A1A1A | #00FF41 | #888888 | 极客、编程 |
| 清新蓝白 | #F0F4FF | #2563EB | #10B981 | 轻松、入门 |
配色原则
- 固定账号色板 — 2-3 种固定配色方案形成品牌认知
- 高对比度 — 信息流中低对比图片会被淹没
- 深色底 + 亮色字 或 浅色底 + 深色字 — 二选一,不混用
- 避免:低饱和灰色(看不清)、纯白底+浅灰字(没存在感)
2025-2026 色彩趋势
- Y3K 未来主义:银白 + 淡紫 + 荧光
- 暖色大地系:米白 + 棕 + 焦糖(传递信任感)
- 哑光宝石色调:翡翠绿 + 酒红 + 琥珀
- 玻璃拟态 Glassmorphism:毛玻璃效果 + 半透明色块
---
五、轮播内页设计
结构建议
| 页码 | 内容 | 设计要点 |
|---|---|---|
| 第1页 | 封面(决定点击率) | 标题醒目、信息量大、强视觉冲击 |
| 第2页 | 引入/背景 | 建立问题或需求 |
| 第3-7页 | 核心内容 | 每页一个要点,信息密度适中 |
| 倒数第2页 | 总结/关键收获 | 回顾要点 |
| 最后1页 | 互动引导 | "关注获取更多"、评论引导 |
一致性规则
- 所有页面统一色板(不超过 4 色)
- 标题位置、字号、字体全组统一
- 背景/纹理/边框风格统一
- 页码标注(01/02/03... 或 1/N、2/N...)
- 品牌元素(logo/水印)位置固定
---
六、字体推荐
安全免费商用字体
| 字体 | 用途 | 风格 |
|---|---|---|
| 阿里巴巴普惠体 Bold | 标题 | 现代、专业 |
| 思源黑体 Bold | 标题(替代) | 中性、通用 |
| 思源黑体 Regular | 正文 | 清晰、易读 |
| 站酷庆科黄油体 | 标题(活泼场景) | 圆润、可爱 |
| 站酷快乐体 | 标题(轻松场景) | 手写、亲切 |
版权风险提醒
- 已有博主因未授权字体被索赔 2 万元
- 避免使用:方正系列(商用需授权)、汉仪系列(部分需授权)、华文系列
- AI 生成图片中的字体由模型决定,一般不涉及版权问题
---
七、NBP 生成的特殊注意事项
长宽比控制
- Gemini 3 Pro Image 通过 prompt 描述控制长宽比
- 必须在 prompt 中明确写:
3:4 portrait aspect ratio, 1080x1440 pixels - 使用
--resolution 2K确保足够清晰 - 偶尔 AI 会忽略长宽比,生成正方形 → 重新生成即可
中文渲染限制
- 标题 ≤ 7 字最可靠
- 单行正文 ≤ 20 字
- 生僻字/低频字容易出错
- 数字和英文渲染比中文更稳定
- 每张图必须人工验证文字准确性
生成建议
- 2K 分辨率下生成,后续可在手机上验证显示
- 一次生成 2-3 个变体供选择
- 套图各页保持同一 Base Style Prompt
- 如果文字出错,简化文字后重新生成(不要在原图上编辑)
小红书配图风格库
经过调研和适配的小红书配图风格。核心原则与 image-to-slides 一致:描述情绪和美学参考,不要微操布局细节。
第一梯队:强烈推荐
1. 极简信息图 Clean Infographic
一句话:干净白底 + 结构化布局 + 色块强调,干货之王。
Base Style Prompt:
VISUAL REFERENCE: Clean data dashboard meets editorial infographic from Monocle magazine.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: Crisp white or light gray background, tech blue (#4A90D9) as primary accent, warm orange (#FF6B35) for emphasis, charcoal (#333333) for text. Clean, breathable, professional.
TEXT RENDERING: Clear typographic hierarchy — large bold heading, medium subheading, small body text. Information is king.封面 Prompt 示例:
Create a clean infographic-style Xiaohongshu cover.
[Base Style]
DESIGN INTENT: The viewer should think "this looks organized and useful, I need to save this."
TEXT TO RENDER:
- Title: "Claude vs GPT"
- Subtitle: "重度用户的真实对比"
Structured layout with clear visual hierarchy. Data feels trustworthy and well-organized.适用:教程、对比、数据、工具推荐 注意:信息密度要高,但不能杂乱
---
2. 大字报 Bold Typography
一句话:文字就是画面,高对比,一眼抓住注意力。
Base Style Prompt:
VISUAL REFERENCE: Brutalist magazine cover meets street poster typography.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: High contrast — either dark background with bright text, or bright background with dark text. Color is used sparingly but dramatically. The text IS the design.
TEXT RENDERING: Title occupies 50-70% of the image area. Typography is the primary visual element, not decoration.封面 Prompt 示例:
Create a bold typography-driven Xiaohongshu cover.
[Base Style]
DESIGN INTENT: Stop the scroll. The viewer reads the title before they even decide to look at the image.
TEXT TO RENDER:
- Title: "别再用ChatGPT了"
- Subtitle: "这3个平替更强"
The title should hit like a headline. Minimal decoration — the words carry all the weight.适用:观点输出、标题党、金句、争议性话题 注意:文字越少越好(3-5字最佳),留白很重要
---
3. 杂志排版 Magazine Layout
一句话:高级感编辑排版,留白考究,字体层级清晰。
Base Style Prompt:
VISUAL REFERENCE: Kinfolk magazine meets Apple product page — elegant, minimal, editorial.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: Muted sophisticated palette — warm whites, soft grays, one muted accent color. Feels expensive and curated.
TEXT RENDERING: Elegant typography with clear hierarchy — display title, deck text, body. Generous letter-spacing and line-height.适用:知识分享、生活方式、品牌内容 注意:内容要精炼,不能塞太多信息
---
4. Snoopy 温暖漫画
一句话:Peanuts 风格温暖插画,亲和力强,适合个人 IP。
Base Style Prompt:
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: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: Warm cream/newspaper tone background, soft muted pastels, warm ink lines. Sunday morning comic page feeling.
TEXT RENDERING: Hand-lettered style title, warm and inviting.适用:个人 IP 打造、故事分享、温暖话题 详细指南:参见 image-to-slides/references/proven-styles-snoopy.md
---
第二梯队:特定场景推荐
5. 新波普 Neo-Pop
一句话:高饱和色块 + 粗边框,潮流年轻感。
Base Style Prompt:
VISUAL REFERENCE: Supreme lookbook meets HYPEBEAST editorial — bold, playful, street.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: Cream background with aggressive color blocking — hot pink, cyan, yellow. Thick black borders frame everything. Typography is the visual.
TEXT RENDERING: Headlines as graphic art — oversized, bold, with thick black outlines.适用:年轻受众、潮流科技、品牌联名 注意:信息量不能太高,以视觉冲击为主
---
6. 手绘白板 Whiteboard Sketch
一句话:xkcd/手绘风,极简但有趣。
Base Style Prompt:
VISUAL REFERENCE: xkcd meets a professor's whiteboard — extreme minimalism, humor, clarity.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: White background, black ink, ONE accent color for emphasis (red or blue). 85% white space.
TEXT RENDERING: Hand-drawn/handwritten feel, rough baselines, arrows and annotations.适用:技术解释、概念科普、趣味教程
---
7. 学习漫画 Educational Manga
一句话:日式学习漫画,角色引导理解概念。
Base Style Prompt:
VISUAL REFERENCE: Japanese educational manga (学習漫画) — a character guides you through the concept.
CANVAS: 3:4 portrait aspect ratio, 1080x1440 pixels, high quality rendering.
COLOR SYSTEM: Bright warm palette, white background with selective color panels, screen-tone gray.
TEXT RENDERING: Bold manga-style titles, speech bubbles for key points, onomatopoeia as decoration.适用:教程、培训、知识科普
---
第三梯队:偶尔使用
| 风格 | 一句话 | 适用 |
|---|---|---|
| 苏联构成主义 | 革命海报风,几何+有限色彩 | 产品发布、keynote风 |
| 像素画 | 8-bit复古游戏感 | 游戏相关、怀旧 |
| 孔版印刷 | 错版套色、纸张质感 | 文艺、设计 |
| 浮世绘 | 日本传统木版画 | 东方美学 |
| 达达拼贴 | 混搭拼贴、反主流 | 创意、实验性 |
---
轮播套图的一致性规则
1. 同一 Base Style — 所有页面共享同一个 Base Style Prompt 2. 色板固定 — 整组不超过 4 种颜色 3. 布局框架一致 — 标题位置、字号层级保持一致 4. 封面最抢眼 — 第1张信息密度最高、视觉冲击最强 5. 末页做引导 — 最后一张放互动引导(关注/收藏/评论) 6. 序号感 — 如果是步骤类,每页标注页码(01/02/03...)
Prompt 反模式(小红书特有)
| 反模式 | 为什么不好 | 替代方案 |
|---|---|---|
| "professional modern clean" | AI 生成出来毫无特色 | 引用具体美学/出版物 |
| 指定文字像素位置 | AI 不按坐标放 | 描述信息层级 |
| 横版构图描述 | 生成出来是横图 | 明确写 "3:4 portrait" |
| 一次渲染超过 30 字 | 中文乱码概率大增 | 分拆成多行短文字 |
| 封面和内页用不同风格 | 套图观感割裂 | 统一 Base Style |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "google-genai>=1.0.0",
# "pillow>=10.0.0",
# "httpx[socks]",
# ]
# ///
"""
Generate images for Xiaohongshu (小红书) posts using Gemini 3 Pro Image API.
Default: 3:4 portrait, 2K resolution (optimal for 小红书).
Usage:
uv run generate_image.py --prompt "image description" --filename "output.png" [--resolution 1K|2K|4K] [--api-key KEY]
uv run generate_image.py --prompt "editing instructions" --filename "output.png" --input-image "input.png"
uv run generate_image.py --prompt "create meme with these" --filename "out.png" -i "ref1.png" -i "ref2.png"
"""
import argparse
import os
import sys
from pathlib import Path
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 Xiaohongshu (小红书) 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., xhs-cover.png)"
)
parser.add_argument(
"--input-image", "-i",
action="append",
help="Input image path(s) for reference/editing. Can be used multiple times: -i img1.png -i img2.png"
)
parser.add_argument(
"--resolution", "-r",
choices=["1K", "2K", "4K"],
default="2K",
help="Output resolution: 1K, 2K (default for XHS), 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)
# Load input images if provided
input_images = []
output_resolution = args.resolution
if args.input_image:
for img_path in args.input_image:
try:
img = PILImage.open(img_path)
input_images.append(img)
print(f"Loaded input image: {img_path} ({img.size[0]}x{img.size[1]})")
except Exception as e:
print(f"Error loading input image {img_path}: {e}", file=sys.stderr)
sys.exit(1)
# Auto-detect resolution from the largest input image
if args.resolution == "2K": # Default value for XHS
max_dim = max(max(img.size) for img in input_images)
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}")
# Build contents (images first if editing, prompt only if generating)
if input_images:
contents = [*input_images, args.prompt]
print(f"Generating with {len(input_images)} reference image(s), resolution {output_resolution}...")
else:
contents = args.prompt
print(f"Generating XHS image (3:4 portrait) 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
saved_img = PILImage.open(str(output_path))
w, h = saved_img.size
ratio = w / h
expected_ratio = 3 / 4 # 0.75
print(f"Dimensions: {w}x{h} (ratio: {ratio:.2f}, expected 3:4 = {expected_ratio:.2f})")
if abs(ratio - expected_ratio) > 0.1:
print(f"⚠️ Warning: Image ratio {ratio:.2f} differs from expected 3:4 ({expected_ratio:.2f}). Consider regenerating.")
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
How it compares
Pick huashu-xhs-image for Xiaohongshu-specific proposal-first visuals; use generic image-generator skills for non-Chinese social formats.
FAQ
Does huashu-xhs-image skip the design proposal step?
huashu-xhs-image never skips the proposal step; the workflow requires understanding content, presenting 2-3 design directions, user selection, generation, preview confirmation, then upload.
When does huashu-xhs-image use HTML instead of Gemini?
huashu-xhs-image uses Gemini by default for Xiaohongshu covers and carousels, reserving HTML screenshot rendering only as a fallback for precise data tables that need exact cell layout.