Community图像github.com

dotslashsimran/image-gen

使用用户自己的 API 密钥(Google Gemini 或 OpenAI gpt-image)生成图像。当需要生成、创建或制作图像、插图、图标、剪贴画、贴纸、缩略图、纹理、模型或视觉素材,编辑图像,或生成多张保持一致的图像时使用。

image-gen 是什么?

该技能提供了一种标准化方式,通过用户自己的 API 密钥调用 Google Gemini 或 OpenAI gpt-image 模型来生成图像。它定义了一个由 Python 脚本驱动的命令行界面,支持并行生成多个变体、控制宽高比、使用参考图像保持角色或物体一致性,以及生成透明背景的剪切图。该技能优先考虑安全性和用户控制——API 密钥仅从环境变量或配置文件读取,绝不会在聊天中暴露。它还为每张图像生成元数据 sidecar 文件,便于后续重建或微调。此技能适用于 Claude Code、Cursor 等支持自定义技能的 AI 代理平台,可帮助开发者快速制作视觉资产,同时保持创作流程的可审计性和可重复性。

兼容平台~Claude Code✓Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/dotslashsimran/simcraft/tree/HEAD/skills/image-gen

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

图像生成

python3 ~/simcraft/skills/image-gen/scripts/gen_image.py "<提示词>" --out <目录> --name <文件名> [选项]

仅依赖标准库,因此任何 python3 均可运行。

密钥

脚本从环境变量读取 GEMINI_API_KEY 和 OPENAI_API_KEY,或从 ~/.config/simcraft/keys.env 读取(每行一个 名称=值,权限设为 600)。

  • 运行 --check 可查看哪些密钥已设置。它从不打印密钥本身。
  • 如果未设置密钥,告知用户自行打开文件(open -e ~/.config/simcraft/keys.env)并粘贴密钥。绝不要要求用户在聊天中粘贴密钥,也绝不要从其他项目的文件中读取密钥。
  • 密钥仅用于请求头部。绝不出现在 URL、日志或 sidecar 文件中。
  • 在 aistudio.google.com/apikey 获取 Gemini 密钥(提供免费套餐)。在 platform.openai.com/api-keys 获取 OpenAI 密钥。

选项

选项功能
--n 4并行生成 4 个变体,同时生成 <文件名>_sheet.png 供选择。对重要作品使用此选项。
--aspect 16:9设置图像宽高比:16:9、9:16、1:1、4:3 或 3:4。根据图像显示位置选择匹配的尺寸。
--ref a.png b.png参考图像。用于编辑图像、匹配风格,或在不同图像间保持角色或物体一致。
--cutout生成用于拼贴的透明 PNG。Gemini 在绿幕上生成图像,脚本通过干净边缘移除背景。OpenAI 直接生成真正的透明图像。
`--provider geminiopenai`
--model M选择模型。默认情况下,Gemini 使用密钥可用的最新图像模型(--models 列出可用模型),OpenAI 使用 gpt-image-2。
`--quality lowmedium
--brand devin将品牌套件的图像风格和调色板添加到提示词中。对于任何品牌工作,先运行品牌套件技能。

每张图像都会生成一个 <文件名>.json sidecar 文件,包含确切的提示词、模型和设置,以便日后重新生成或微调。

选择提供商

  • Gemini: 快速且便宜。最适合迭代、编辑以及通过 --ref 保持一致性。
  • OpenAI gpt-image: 最适合包含文字的图像以及真正的透明剪切图。

提示词技巧

  • 按顺序描述主体、媒介、光线和构图。明确说明要省略什么。
  • 除非用户要求,否则不要在图像中加入文字。模型仍然会拼错单词。之后再在代码中添加文字排版。
  • 对于系列图像,先生成一张锚点图像。然后将同一张锚点图像作为 --ref 传递给其他所有图像。切勿将图像 2 链接到图像 3,因为小错误会累积。
  • 在使用图像前,向用户展示合成图。仅重新生成其中一个变体,而不是全部。

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

dotslashsimran/clean-audio

Clean up voice audio in a video: rumble, electrical hum, background noise and hiss, muddy or harsh tone, sharp S sounds, uneven volume, and loudness for YouTube/Instagram/TikTok. Measures the audio first, picks the strongest cleanup that doesn't make the words less clear, and keeps lip sync exact. Use when the user says "clean up the audio", "fix the sound", "remove background noise", "remove hum", "my audio is too quiet/loud", "make it sound better", or after a rough cut.

dotslashsimran/perspective-illusion

Make a looping illustrated 3D video that plays with perception, the way Japanese illusion artists do (e.g. @garments__): a scene squashed flat by a telephoto lens morphs into deep perspective, things that looked side by side turn out to be at different depths, and objects quietly swap position while the view is flat. Also for recreating a reference illusion video, or a new scene (street, supermarket, station, room) in that style. Use when asked for a perspective/optical-illusion video, a "dolly zoom" or "flat to 3D" effect, or to recreate one of these clips.

dotslashsimran/rough-cut

Trim the fat from raw talking footage. Turns raw video into a tight first cut by removing dead air, ums and uhs, stutters, false starts and bad takes (keeping the last good take), then checks the result by listening to it again. Use when the user says "rough cut", "first cut", "trim the fat", "cut the pauses", "remove the ums", "cut my retakes", "make it snappy", or hands over raw footage to edit.

相关技能