mcpField
I
image-prompt-generator

image-prompt-generator

github.com/cdeistopened创意与媒体29291 次安装16 周前更新
代码仓库

关于 image-prompt-generator

image-prompt-generator 是面向图像创作者的技能,指导从概念构思、提示词优化到使用 Gemini API 生成和修改图像。它还提供风格参考、尺寸与构图选项及迭代建议。

主要功能

  1. 01构思视觉概念并优化提示词
  2. 02通过 Gemini API 生成图像
  3. 03选择模型、尺寸和宽高比
  4. 04使用参考图修改现有图像
  5. 05提供风格参考与迭代建议

适用场景

  1. 01为网页素材或缩略图设计图像
  2. 02将概念整理成具体图像提示词
  3. 03调整现有图像的风格或元素
  4. 04为同一视觉方向尝试不同版本

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/cdeistopened/skill-stack --skill image-prompt-generator

安装后在 Claude Code 中输入/image-prompt-generator确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/styles/
editorial-conceptual.md
minimalist-ink.md
risograph.md
schematic.md
watercolor-line.md
scripts/
generate_image.py

详细介绍

图像提示词生成器

使用 Google 的 Gemini API 生成专业、非千篇一律的图像。

前提条件与设置

获取 Gemini API 密钥
  1. 前往 Google AI Studio
  2. 使用 Google 账号登录
  3. 点击“Create API Key”
  4. 复制生成的密钥
配置 API 密钥

选项 1:环境文件(推荐)

在项目根目录中创建一个 .env 文件:

GEMINI_API_KEY=your_api_key_here

选项 2:直接设置环境变量

export GEMINI_API_KEY=your_api_key_here
安装依赖
pip install google-generativeai python-dotenv pillow
可用模型
模型API 名称最适用于
Flashgemini-2.5-flash-image速度、草稿、迭代
Progemini-3-pro-image-preview最终素材、16:9 宽高比、质量
图像尺寸(对质量至关重要)
尺寸输出文件大小用途
1K约 400KB草稿、迭代
2K约 2MB缩略图、网页素材(默认)
4K约 7MB印刷、高分辨率需求

至关重要:最终素材务必指定 --size 2K 或 --size 4K。否则,输出默认采用 1K,画质会显得较差。

技能栈缩略图——必须使用的设置

对于任何技能栈缩略图,必须使用:

python scripts/images/generate_image.py "YOUR PROMPT" \
  --model pro \
  --size 2K \
  --aspect 16:9 \
  --output public/images/thumbnails \
  --name your-slug

并且提示词必须包含孔版印刷风格说明:

STYLE: Risograph / screen print aesthetic. Visible halftone dots throughout. 
Slight misregistration between color layers. Indie printmaking quality - warm, tactile, handmade.

COLOR: Warm cream base. Charcoal and gray tones. Terracotta (#D4654A) accent on ONE key element.

TEXTURE: Visible halftone pattern. Paper grain. NOT smooth digital gradients.

AVOID: Empty white borders, photorealism, glossy renders, smooth gradients, clip art aesthetic.

原因:不使用 --size 2K,输出就只有约 400KB,画质很差,看起来像是用 Flash 制作的。不采用孔版印刷风格,输出看起来就会千篇一律,带有 AI 生成的痕迹。


工作流概览

  1. 构思创意——生成 4 至 6 个高层次的视觉构想
  2. 选择方向——由用户选出喜欢的构想
  3. 优化提示词——将构想完善为有力、详尽的提示词
  4. 风格变体——改编为 2 至 3 种不同的视觉风格
  5. 生成图像——通过 Gemini API 运行

第 1 步:构思创意

用户提供主题或使用场景时,生成 3 个高层次的视觉构想,并指出你的首选。每个构想应当:

  • 用 一句话 描述视觉创意
  • 具体且直观——让人一眼就能想象出来
  • 有概念性但不抽象——呈现含义明确的物体或场景
  • 避免千篇一律——避开陈词滥调(例如,不要用灯泡代表创意,也不要用握手代表合作)

格式:

**Concept A:** One sentence description of the visual concept and why it works.

**Concept B:** One sentence description...

**Concept C:** One sentence description...

**My pick: Concept X** — Brief reasoning why this one is strongest.

“关于个人效率的新闻简报”示例:

**Concept A:** A vintage compass where the needle points toward a coffee ring stain on a map—direction emerges from daily rituals.

**Concept B:** A clock where the 12 hours show seasonal changes—time management over long arcs, not just hours.

**Concept C:** One small key attached to dozens of decorative keychains—we overcomplicate simple solutions.

**My pick: Concept A** — The coffee stain is unexpected and personal, the compass is concrete without being cliché.

继续之前,等待用户确认或调整方向。

第 2 步:优化提示词

用户选定一个构想后,将其扩展为完整提示词。结构如下:

Create a [style type] illustration of [subject].

CONCEPT: [Expand the one-sentence idea into a clear visual description]

STYLE: [Artistic approach - load from references/styles/ if brand-specific]

COMPOSITION: [Framing, focal point, negative space, balance]

COLORS: [Palette - describe by name, not hex codes which may render as text]

TEXTURE: [Surface qualities, analog/digital feel]

AVOID: [What should NOT appear - be specific]

FORMAT: [Aspect ratio]

关键原则:

  • 使用自然语言和完整句子——不要堆砌标签
  • 用名称描述颜色(烧橙色、天蓝色、近黑色),不要使用十六进制代码
  • 最多包含 2 至 3 个元素——如果显得杂乱,就删去一些
  • 优先使用隐喻,而非直白描绘

第 3 步:风格变体

技能栈项目必须采用孔版印刷风格。 每张缩略图的提示词都必须包含孔版印刷风格说明。请参阅 references/styles/risograph.md。

提示词中必须始终包含以下孔版印刷风格要素:

  • “全图可见半色调网点”
  • “色彩层之间有轻微错位”
  • “独立印刷艺术质感——温暖、细腻、有手工感”
  • “不要使用平滑的数字渐变”

references/styles/ 中的可用风格(用于非技能栈项目):

  • risograph.md - 默认风格。半色调网点、套印错位、独立印刷艺术美感。
  • minimalist-ink.md - 高对比度黑白风格,采用交叉排线。
  • watercolor-line.md - 墨线配合水彩晕染。
  • editorial-conceptual.md - 富有概念性、精致且带有编辑式巧思。

第 4 步:通过 API 生成

运行脚本
# Generate 2K thumbnail (recommended for web)
python scripts/images/generate_image.py "prompt here" --model pro --aspect 16:9 --size 2K

# Generate 4K for print/high-res
python scripts/images/generate_image.py "prompt here" --model pro --size 4K

# Save to specific folder
python scripts/images/generate_image.py "prompt" --output "./images" --name "my_image" --size 2K

选项:

  • --model pro(默认,质量更高)或 --model flash(速度更快)
  • --size 2K(默认)、1K 或 4K —— 最终素材始终使用 2K 或 4K
  • --aspect 16:9(默认)、1:1、9:16、3:4、4:3
  • --variations N —— 生成 N 个版本
  • --output ./path —— 保存位置
  • --name prefix —— 文件名前缀

输出位置: 将图片保存在其所属内容旁边,不要统一丢到通用图片目录中。

第 5 步:迭代

用户查看生成的图片后:

  • 80% 满意? 通过对话提出具体修改,而不是重新生成
  • 构图不理想? 在提示词中调整取景或元素位置
  • 风格不对? 尝试不同的风格参考
  • 内容太杂? 精简元素
  • 颜色不对? 更明确地指定配色

提示词原则

像创意总监一样撰写

像向人类艺术家简报那样向模型说明。使用语法规范的完整句子和富有描述性的形容词。

不要这样写应该这样写
“酷车、霓虹、城市、夜晚、8k”“未来感跑车在雨夜的东京街道上飞驰的电影感宽幅镜头。霓虹灯牌倒映在湿润的路面和汽车的金属车身上。”

具体说明:

  • 主体: 不要只说“一位女性”,而要说“一位穿着复古香奈儿风格套装、气质优雅的年长女性”
  • 材质: 描述质感,例如“哑光表面”“拉丝钢”“柔软天鹅绒”“皱褶纸张”
  • 场景: 明确地点、时间和天气
  • 光线: 指定氛围和光源
  • 情绪: 图片的情感基调
提供背景信息

背景信息有助于模型做出合乎逻辑的艺术创作决策。说明“为什么”或“面向谁”。

示例:“为一本巴西高端美食食谱创作一张三明治图片。” (模型会推断:专业摆盘、浅景深、完美光线)

保持简洁
  • 一个明确的视觉焦点
  • 总元素最多 2-3 个
  • 留出充足的负空间
  • 如果画面显得杂乱,就删掉一些元素
避免平庸的套路

硬性规则:

  • 绝不要在图片中加入文字——文字渲染效果差,看起来很业余
  • 表示“创意”时不要用灯泡
  • 表示“合作”时不要用握手
  • 表示“播客”或“音频”时不要用音频波形
  • 表示“系统”或“流程”时不要用齿轮
  • 不要使用摆拍的开心图库照片姿势
  • 不要采用光鲜亮丽的 AI 美学风格
  • 表示“连接”或“集成”时不要用拼图块
行之有效的隐喻

以往生成效果出色的概念:

  • 切开的橙子,内部显露出神经网络——有机外观与系统化内在(知识系统、RAG)
  • 信件投递口中飞出一只折纸鸟——投递转化为鲜活之物(新闻通讯)
  • 健身俱乐部与羽毛笔交叠——身体锻炼与智力工作相结合(身体 + 思维)
  • 打字机按键的极近特写,周围散发冲击力——果断行动、指令(书籍、权威)
  • 滴管与盛开的曼陀罗——临床精准与超越性相结合(治疗、转变)
  • 皮革磨刀带上的直剃刀——精准工具、打磨、精进(编辑、制作)
  • 棱镜将光线分散成清晰的光束——一个输入,多种输出(框架)
  • 地图上留有咖啡渍的指南针——从日常仪式中找到方向(效率)

资源

references/styles/

美学风格定义:

  • risograph.md - 默认——半色调、套印不准、独立印刷
  • minimalist-ink.md - 黑白水墨插画
  • watercolor-line.md - 水墨线条搭配水彩晕染
  • editorial-conceptual.md - 概念性编辑风格
scripts/
  • generate_image.py - Gemini API 图片生成

提示词修饰词参考

类别示例
光照黄金时段,戏剧性阴影,柔和的漫射光,霓虹光晕,阴天
风格电影感,编辑风格,技术图解,手绘,照片级写实
纹理哑光表面,拉丝钢材,柔软天鹅绒,揉皱的纸张,风化木材
构图广角镜头,特写,鸟瞰视角,荷兰角构图,对称
氛围活力十足,宁静,戏剧性,俏皮,精致
质量4K,高保真,像素级精准,专业级

高级功能

文本渲染与信息图表

将准确的文本放在引号中。指定风格:“精致的编辑风格”“技术图解”或“手绘白板”。

提示词示例:

Earnings Report Infographic:
"Generate a clean, modern infographic summarizing the key financial highlights from this earnings report. Include charts for 'Revenue Growth' and 'Net Income', and highlight the CEO's key quote in a stylized pull-quote box."
Whiteboard Summary:
"Summarize the concept of 'Transformer Neural Network Architecture' as a hand-drawn whiteboard diagram suitable for a university lecture. Use different colored markers for the Encoder and Decoder blocks, and include legible labels for 'Self-Attention' and 'Feed Forward'."
角色一致性与缩略图

使用参考图像,并注明“人物的面部特征必须与图像 1 完全一致。”描述表情或动作的变化,同时保持角色身份不变。

提示词示例:

Viral Thumbnail:
"Design a viral video thumbnail using the person from Image 1.
Face Consistency: Keep the person's facial features exactly the same as Image 1, but change their expression to look excited and surprised.
Action: Pose the person on the left side, pointing their finger towards the right side of the frame.
Subject: On the right side, place a high-quality image of a delicious avocado toast.
Graphics: Add a bold yellow arrow connecting the person's finger to the toast.
Text: Overlay massive, pop-style text in the middle: 'Done in 3 mins!'. Use a thick white outline and drop shadow.
Background: A blurred, bright kitchen background. High saturation and contrast."
图像重制作(编辑现有图像)

--input 标志可启用“重制作模式”——将现有图像传递给 Gemini,并描述你希望进行的更改。

主要用例:

  • 微调 - 调整颜色,添加或移除元素,改变光照
  • 风格迁移 - 保持构图不变,但更改艺术风格
  • 对象操作 - 移除、添加或修改特定对象
  • 季节/时间变化 - 同一场景,不同时间或季节

以重制作模式运行:

# Basic edit - add something
python scripts/generate_image.py "Add snow to the roof and yard" \
  --input ./house.png \
  --model pro

# Color adjustment
python scripts/generate_image.py "Change the accent color from red to teal, keep everything else identical" \
  --input ./thumbnail.png \
  --model pro

# Style transfer - keep composition, change aesthetic
python scripts/generate_image.py "Convert this to risograph style with halftone dots and slight color misregistration" \
  --input ./photo.png \
  --model pro

# Generate variations of an edit
python scripts/generate_image.py "Make the lighting warmer, like golden hour" \
  --input ./portrait.png \
  --variations 3 \
  --model pro

重制作模式的提示技巧:

  1. 具体说明要保留的内容:

    • “人物的面部特征必须完全保持不变”
    • “保持构图和取景不变”
    • “不要更改背景”
  2. 明确说明要更改的内容:

    • “只将衬衫的颜色从蓝色改为红色”
    • “在屋顶上添加雪,其他内容一律不变”
    • “移除文字叠加层”
  3. 使用比较性措辞:

    • “让颜色更加鲜艳”
    • “稍微提高对比度”
    • “让光线更加柔和、漫射”

**输出命名:**重制作模式生成的文件命名为 {prefix}_{timestamp}_edit_{model}.png,以区别于生成的图像(_gen_)。

高级编辑示例

移除对象:

python scripts/generate_image.py \
  "Remove the tourists from the background and fill with matching cobblestones and storefronts" \
  --input ./street-photo.png \
  --model pro

控制季节:

python scripts/generate_image.py \
  "Turn this into winter. Add snow to the roof and yard. Change lighting to cold, overcast afternoon. Keep architecture identical." \
  --input ./house-summer.png \
  --model pro

角色一致性(缩略图系列):

python scripts/generate_image.py \
  "Keep the person's face exactly the same. Change expression to surprised. Add a pointing gesture toward the right side of the frame." \
  --input ./person-reference.png \
  --model pro

相关技能

  • youtube-title-creator - 为生成的图像配上优化后的标题
  • social-content-creation - 在针对平台优化的帖子中使用图像

如需自定义品牌风格,请按照现有格式在 references/styles/ 中创建新的风格文件

评论

支持 Markdown