mcpField
T
text-to-image-prompt-optimizer

text-to-image-prompt-optimizer

github.com/manzxiao创意与媒体2521 次安装38 周前更新
代码仓库

关于 text-to-image-prompt-optimizer

面向使用生成式 AI 图像工具的提示词编写技能,默认采用 Google Gemini(Nano Banana)。它提供适配不同平台的提示词格式与多个变体,并说明提示词要素及其选择理由。

主要功能

  1. 01默认使用 Google Gemini(Nano Banana)
  2. 02生成 2–3 个提示词变体
  3. 03支持 Midjourney、Stable Diffusion 等
  4. 04提供英文提示词和中文翻译
  5. 05说明提示词组成及选择理由
  6. 06建议平台专属参数

适用场景

  1. 01根据简要构想起草提示词
  2. 02优化已有图像提示词
  3. 03将提示词适配到指定图像平台
  4. 04探索不同风格或构图变体

安装

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

$npx skills add https://github.com/manzxiao/text-to-image-prompt-optimizer --skill text-to-image-prompt-optimizer

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

包含的文件

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

LICENSE
.gitignore
README.md
references/
platform-specific.md
prompt-library.md
keywords-reference.md

详细介绍

AI 图像提示词优化器

为 AI 图像生成工具生成专业、优化的提示词,主要支持 Google Gemini(Nano Banana),同时支持 Midjourney、Stable Diffusion、DALL-E、Leonardo.ai 等工具。

核心工作流

当用户请求生成或优化提示词时:

  1. 理解意图

    • 确定核心主体和预期效果
    • 仅当请求极其模糊时才提出澄清问题
    • 默认采用合理假设,避免过度追问
  2. 生成全面的提示词

    • 首选格式:Google Gemini(Nano Banana)——使用对话式自然语言,并融入摄影/电影术语
    • 提供多种变体(2-3 种),采用不同的风格或方法
    • 同时提供英文(首选)和中文翻译
    • 对 Gemini:使用清晰、具体的句子,而非关键词列表
    • 对其他平台:按公式组织:[Subject] + [Environment] + [Style] + [Lighting] + [Composition] + [Quality]
  3. 加入针对平台的优化

    • Gemini(Nano Banana)——首选:使用清晰的对话式提示词,融入摄影/电影语言和语义明确的正向描述
    • Midjourney(次选):酌情添加 --ar、--s、--q 等参数
    • Stable Diffusion(次选):建议采样步数、CFG scale 和负面提示词
    • 根据用户指定的平台进行调整;未指定时默认使用 Gemini
  4. 解释并提供指导

    • 分解提示词的各个组成部分
    • 解释选择特定关键词的原因
    • 建议如何修改以实现不同效果
  5. 提供可执行的后续步骤

    • 指导用户如何使用提示词
    • 建议调整参数以进一步优化
    • 根据生成结果提供迭代优化

输出格式

按以下结构组织回复(优先采用 Gemini 格式):

## 🎨 Generated Prompts

### ⭐ Variation 1: Google Gemini (Nano Banana) - RECOMMENDED
**English (Conversational):**
[Natural language prompt with clear, descriptive sentences using photographic/cinematic terminology]

**中文版本:**
[Chinese translation in conversational style]

**适用平台:** Google Gemini (Nano Banana / Nano Banana Pro)
**推荐模型:** [Nano Banana for testing / Nano Banana Pro for professional output]

---

### Variation 2: [Alternative Style/Platform]
**English:**
[Platform-specific format - keywords for Midjourney, structured for SD, etc.]

**中文版本:**
[Chinese translation]

**适用平台:** [Midjourney / Stable Diffusion / DALL-E / Leonardo.ai]

---

### Variation 3: [Another Alternative]
[Optional third variation if helpful]

---

## 📝 Prompt Breakdown

- **Subject:** [Explanation]
- **Composition:** [How elements are arranged - important for Gemini]
- **Lighting:** [Photography/cinematography terms used]
- **Style:** [Visual aesthetic description]
- **Technical:** [Camera terms, angles, etc. for Gemini]

## ⚙️ Platform Guide

**🌟 Gemini (Primary):**
- Model choice: [When to use Nano Banana vs Pro]
- Editing tips: [How to iterate conversationally]
- Special features: [Character consistency, multi-image, etc.]

**Other Platforms (Secondary):**
[Brief notes on Midjourney/SD/etc. parameters if relevant]

## 💡 Optimization Tips

[Gemini-focused suggestions first, then others]

## 🎯 Next Steps

**For Gemini:**
1. [How to use in Gemini app/AI Studio]
2. [How to iterate with conversational edits]
3. [How to leverage character consistency / multi-image features]

**For Other Platforms:**
[Platform-specific usage notes if requested]

核心原则

简洁
  • 直接生成提示词,避免冗长的铺垫
  • 避免使用“我来帮你创建提示词……”之类的表达
  • 除非确实需要澄清,否则直接给出提示词
重质不重量
  • 使用具体、有表现力的关键词,而非笼统描述
  • 优先使用“电影感光线、戏剧性阴影、黄金时刻”,而非“好看的光线”
  • 适当参考成熟的艺术风格
平台适配
  • 未指定平台时,默认使用 Google Gemini(Nano Banana)格式——采用对话式自然语言
  • 始终优先提供 Gemini 版本作为首选建议
  • 将其他平台格式(Midjourney、SD 等)作为次选方案
  • 自动为各目标平台添加适当参数
  • 在适用时突出 Gemini 的独特功能(角色一致性、对话式编辑)
教育价值
  • 解释特定关键词为何有效
  • 帮助用户逐步学会自行编写提示词
  • 引导用户参考提示词库以深入学习

常见模式

面向初学者
  • 使用更简单、直接的提示词
  • 详细解释每个组成部分
  • 提供可修改的模板
面向有经验的用户
  • 侧重高级技巧(权重、负面提示词、多概念融合)
  • 建议艺术家参考和风格混搭
  • 除非用户提出要求,否则尽量少作解释

参考资料

如需完整的提示词模板和关键词库,请参阅:

在以下情况下加载这些参考资料:

  • 用户请求特定类别(人像、风景等)
  • 用户寻求关键词建议
  • 用户需要针对特定平台的指导
  • 需要复杂或专业的提示词

高级技巧

🌟 Gemini(Nano Banana)技巧 - 主要
角色一致性
First prompt: "Generate a character: [detailed description]"
Follow-up: "Show the same character [in new scenario/pose/style]"
# Gemini will maintain character likeness across images
对话式编辑
Initial: "Create [image description]"
Edits:
- "Make the background darker"
- "Add [element] to the scene"
- "Change [attribute] to [new value]"
# Each edit builds on the previous image
摄影控制
Use technical terms:
- "85mm portrait lens at f/1.8" (lens + aperture)
- "wide-angle shot from low angle" (lens + perspective)
- "shallow depth of field with bokeh" (focus effect)
- "golden hour lighting from left" (lighting direction)
语义化正向描述
Instead of: "no cars, no people"
Use: "an empty, peaceful street with no signs of activity"

Instead of: "not blurry"
Use: "sharp focus, crystal clear, professional quality"

其他平台技巧(次要)
权重控制(Midjourney)
(red flower)::2 (blue flower)::1
# Red flower weighted 2x more than blue
负面提示词(Stable Diffusion)
Negative prompt: ugly, blurry, low quality, distorted,
bad anatomy, watermark, text
风格混合(多个平台)
in the style of [Artist A] combined with [Artist B]
多概念融合(多个平台)
a fusion of [concept 1] and [concept 2]

快速模板

🌟 Gemini(Nano Banana)模板 - 主要
对话式公式(推荐)
Create/Generate [subject description] [action/state].
The scene should show [environment details] with [composition description].
Use [lighting description] to create [mood/atmosphere].
The style should be [visual style] with [quality description].
肖像(Gemini)
Generate a professional portrait of [age/gender], [appearance details],
wearing [clothing]. The subject should have [expression/mood].
Use [lens/angle] perspective with [lighting description].
The background should be [background details]. The style should be
[photographic/artistic style] with [quality expectations].
风景(Gemini)
Create a [location/scene type] during [time/season]. The scene should
feature [key elements] with [weather/atmosphere]. Use [angle/perspective]
to capture [compositional focus]. The lighting should be [lighting type]
creating [mood]. Style: [photographic/artistic approach].
产品(Gemini)
Generate a product photograph of [product] made of [material].
Position it on/against [background/surface] with [arrangement details].
Use [lighting setup] from [direction] creating [shadow/highlight effect].
Shot with [camera/lens details] at [angle]. The aesthetic should be
[style] suitable for [purpose].
角色设计(Gemini)
Create a character: [description of person/creature] with [physical features].
They should be wearing [clothing/armor/accessories] and have [expression/pose].
The setting is [environment]. Use [art style] with [detail level].

其他平台模板(次要)
基础关键词公式(Midjourney/SD)
[subject], [environment], [style], [lighting], [composition], [quality]
肖像(关键词风格)
[age/gender], [appearance], [clothing], [expression], [background],
[style], portrait photography, [quality]
风景(关键词风格)
[location], [time/season], [weather], [color mood],
landscape photography, [angle], [quality]
产品(关键词风格)
[product], [material], [background], product photography,
[lighting], [angle], commercial, [quality]
概念艺术(关键词风格)
[subject], [details], [genre] art, [atmosphere],
concept art, highly detailed, trending on ArtStation, [quality]

按类别划分的常用关键词

质量:

  • 4k、8k、超高清、高分辨率
  • 细节丰富、焦点清晰
  • 杰作、专业
  • 照片级真实、超写实

光线:

  • 自然光、黄金时段、柔和光线
  • 戏剧性光线、体积光
  • 影棚灯光、轮廓光

构图:

  • 特写、广角、鸟瞰视角
  • 浅景深、散景
  • 三分法、居中

风格:

  • 电影感、艺术感、极简主义
  • 赛博朋克、奇幻艺术、动漫风格
  • 照片级真实、油画、水彩画

氛围:

  • 宁静、戏剧性、神秘
  • 温馨、史诗感、空灵
  • 鲜艳、忧郁

处理用户请求

“为[简单创意]生成提示词”

根据合理假设扩展创意,提供 2-3 种变体,并解释选择原因。

“优化这个提示词:[现有提示词]”

分析现有提示词,找出不足之处,提供改进版本并加以说明。

“我想要[特定风格]”

使用该风格专属的关键词和艺术家参考,并提供示例。

“让它更好/更详细”

添加质量关键词,完善构图,提升具体程度。

“创建变体”

生成 3-4 种在风格、氛围或构图上有所不同的变体。

编写有效提示词的技巧

  1. 具体明确 —— “一只金毛幼犬”胜过“狗”
  2. 使用艺术家/风格参考 —— “吉卜力工作室风格”
  3. 质量关键词很重要 —— 始终加入质量描述词
  4. 顺序很重要 —— 越靠前的关键词影响越大
  5. 测试并迭代 —— 鼓励用户分享结果,以便进一步优化

何时查阅参考资料

  • 特定类别:阅读 prompt-library.md 中有关肖像、风景等内容的章节。
  • 关键词建议:查阅 keywords-reference.md,获取完整的关键词列表。
  • 平台详情:查看 platform-specific.md,了解高级参数。
  • 复杂请求:加载相关参考资料,以提供全面指导

评论

支持 Markdown