gemini-image-gen by jezweb/claude-skills
npx skills add https://github.com/jezweb/claude-skills --skill gemini-image-gen使用 Gemini API 为网页项目生成上下文相关的图像。可生成英雄背景图、OG 卡片图、占位照片、纹理以及风格匹配的变体。
API 密钥 : 将 GEMINI_API_KEY 设置为环境变量。如果没有密钥,请从 https://aistudio.google.com/apikey 获取。
export GEMINI_API_KEY="your-key-here"
从用户或项目上下文中收集信息:
使用具体的摄影参数,而非抽象的形容词。完整框架请阅读 references/prompting-guide.md。
快速规则 :
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
生成一个调用 Gemini API 的 Python 脚本(仅依赖标准库)。脚本应:
GEMINI_API_KEYhttps://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent 发送 POST 请求"responseModalities": ["TEXT", "IMAGE"]inlineData.data (base64)name-1.png、name-2.png)对于使用参考图像的风格匹配,请在文本提示词之前将参考图像作为 inlineData 部分包含,并使用 temperature 0.7(而不是 1.0)。
完整实现模式(包括错误处理和响应解析)请参见 references/api-pattern.md。
关键点 : 切勿通过 curl + bash 参数传递提示词 — 撇号会破坏 shell 转义。始终使用 Python 的 json.dumps() 或先将提示词写入文件。
使用 image-processing 技能进行尺寸调整、格式转换或优化。
展示生成的图像以供审阅。如果可能,读取图像文件以行内显示它们,否则描述生成了什么并让用户打开查看。
初始提示词 — 可根据项目特定上下文(颜色、情绪、主题)进行增强:
| 预设 | 基础提示词 |
|---|---|
hero-background | "宽广的氛围背景,柔焦,[颜色色调],[情绪],风景 1920x1080" |
og-image | "简洁的品牌卡片背景,[品牌颜色],微妙的渐变,1200x630" |
placeholder-photo | "[主题] 的专业图库风格照片,自然光照,暖色调" |
texture-pattern | "微妙的重复纹理,[材质],无缝平铺,柔和的[颜色]" |
product-shot | "产品摄影,[物品] 置于[表面]上,柔和的影棚灯光,干净背景" |
| 用途 | 模型 | 成本 |
|---|---|---|
| 草稿、快速占位图 | gemini-2.5-flash-image | 免费(约 500 次/天) |
| 最终客户素材 | gemini-3-pro-image-preview | 约 $0.04/张 |
| 风格匹配变体 | gemini-3-pro-image-preview + 参考图像 | 约 $0.04/张 |
如果出现错误,请验证当前模型 ID — 它们经常变化。
| 时机 | 阅读 |
|---|---|
| 构建有效提示词时 | references/prompting-guide.md |
| API 实现细节 | references/api-pattern.md |
每周安装量
197
代码仓库
GitHub 星标数
652
首次出现
2026年2月26日
安全审计
安装于
codex179
gemini-cli178
github-copilot178
opencode178
amp177
cursor177
Generate contextual images for web projects using the Gemini API. Produces hero backgrounds, OG cards, placeholder photos, textures, and style-matched variants.
API Key : Set GEMINI_API_KEY as an environment variable. Get a key from https://aistudio.google.com/apikey if you don't have one.
export GEMINI_API_KEY="your-key-here"
Gather from the user or project context:
Use concrete photography parameters, not abstract adjectives. Read references/prompting-guide.md for the full framework.
Quick rules :
Generate a Python script (no dependencies beyond stdlib) that calls the Gemini API. The script should:
GEMINI_API_KEY from environmenthttps://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent"responseModalities": ["TEXT", "IMAGE"] in generationConfiginlineData.data (base64) from candidate partsname-1.png, name-2.png)For style matching with a reference image, include the reference as an inlineData part before the text prompt, and use temperature 0.7 (instead of 1.0).
See references/api-pattern.md for the full implementation pattern including error handling and response parsing.
Critical : Never pass prompts via curl + bash arguments — shell escaping breaks on apostrophes. Always use Python's json.dumps() or write the prompt to a file first.
Use the image-processing skill for resizing, format conversion, or optimisation.
Show the generated images for review. Read the image files to display them inline if possible, otherwise describe what was generated and let the user open them.
Starting prompts — enhance with project-specific context (colours, mood, subject):
| Preset | Base Prompt |
|---|---|
hero-background | "Wide atmospheric background, soft-focus, [colour tones], [mood], landscape 1920x1080" |
og-image | "Clean branded card background, [brand colours], subtle gradient, 1200x630" |
placeholder-photo | "Professional stock-style photo of [subject], natural lighting, warm tones" |
texture-pattern | "Subtle repeating texture, [material], seamless tile, muted [colour]" |
product-shot | "Product photography, [item] on [surface], soft studio lighting, clean background" |
| Use case | Model | Cost |
|---|---|---|
| Drafts, quick placeholders | gemini-2.5-flash-image | Free (~500/day) |
| Final client assets | gemini-3-pro-image-preview | ~$0.04/image |
| Style-matched variants | gemini-3-pro-image-preview + reference image | ~$0.04/image |
Verify current model IDs if errors occur — they change frequently.
| When | Read |
|---|---|
| Building effective prompts | references/prompting-guide.md |
| API implementation details | references/api-pattern.md |
Weekly Installs
197
Repository
GitHub Stars
652
First Seen
Feb 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex179
gemini-cli178
github-copilot178
opencode178
amp177
cursor177
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
46,500 周安装