imagegen-gemini
Generate or edit raster images with Gemini (Nano Banana): photos, illustrations, textures, sprites, mockups, character cutouts, transparent-background subjects, batches of variants. Use when the output should be a bitmap asset rather than SVG, vector, or code-native visuals.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- imagegen-gemini
- description
- Generate or edit raster images with Gemini (Nano Banana): photos, illustrations, textures, sprites, mockups, character cutouts, transparent-background subjects, batches of variants. Use when the output should be a bitmap asset rather than SVG, vector, or code-native visuals.
02 资源文件 9
- 参考文档agents/openai.yaml281 B
- 资产文件assets/imagegen-small.svg2.8 KB
- 资产文件assets/imagegen.png1.7 KB
- 参考文档reference/CLI.md5.0 KB
- 参考文档reference/PROMPTING.md7.5 KB
- 参考文档reference/SAMPLE-PROMPTS.md16.6 KB
- 参考文档reference/TRANSPARENCY.md1.8 KB
- 脚本scripts/image_gen.py14.7 KB
- 脚本scripts/remove_chroma_key.py13.4 KB
03 SKILL.md 正文
Image Generation (Gemini)
Generates or edits bitmap images for the current project through the bundled scripts/image_gen.py, which calls the Gemini Image API. Standard library only; needs GEMINI_API_KEY in the environment.
Fit
Reach for it when the asset is a photo, illustration, texture, sprite, mockup, or cutout. Build diagrams, icons, logos that extend an existing SVG system, and anything deterministic directly in SVG, HTML/CSS, or canvas. A real screenshot or existing project art beats a generated stand-in.
Workflow
- Intent. Edit when the user wants to change an existing image while keeping parts of it. Generate when images are only style or subject references, or when none are given.
- Destination. Project-bound output goes into the workspace (user-named path, else
output/imagegen/). Preview-only output can stay intmp/imagegen/. - Inputs. Collect the prompt, exact text (verbatim), constraints, and input images. Give each image a role: edit target (first
--image) or reference. - Prompt. Write the labeled spec below and read reference/PROMPTING.md for specificity, text, and edit invariants. Copy-paste recipes per asset type: reference/SAMPLE-PROMPTS.md.
- Run. Execute the script (see reference/CLI.md for flags, models, batch, and troubleshooting):
Many distinct assets: onepython3 scripts/image_gen.py generate --prompt "..." --aspect-ratio 16:9 --size 2K --out output/imagegen/hero.jpggenerate-batchJSONL job per asset. Variants of one prompt:--n. Resolvescripts/against this skill's directory. - Transparent subject. Gemini returns opaque pixels. Read reference/TRANSPARENCY.md: generate on a flat key color, then remove it with
scripts/remove_chroma_key.py. - Inspect. Open every output and check subject, style, composition, text accuracy, and the constraints. Iterate with one targeted change, repeating the invariants each time.
- Deliver. Done when every requested file sits at its destination and you have reported, per asset: saved path, final prompt, and model. Keep only selected finals; delete discarded variants and scratch files unless asked to keep them. Existing assets are replaced only on explicit request; otherwise save a sibling such as
hero-v2.jpg.
If a missing detail blocks success, ask one question; otherwise proceed.
Prompt spec
Use only the lines that help. Keep specific prompts specific (normalize, do not expand); enrich generic ones with composition, polish level, and practical layout cues only.
Use case: <taxonomy slug>
Asset type: <where the asset will be used>
Primary request: <user's main prompt>
Input images: <Image 1: role; Image 2: role>
Scene/backdrop: <environment>
Subject: <main subject>
Style/medium: <photo/illustration/3D/etc>
Composition/framing: <wide/close/top-down; placement>
Lighting/mood: <lighting + mood>
Color palette: <palette notes>
Materials/textures: <surface details>
Text (verbatim): "<exact text>"
Constraints: <must keep / must have>
Avoid: <described positively, e.g. "an empty street" instead of "no cars">
The script builds this spec from flags (--use-case, --scene, --subject, ...) and labels input images itself. --no-augment sends a hand-written prompt verbatim.
Use-case slugs
Generate: photorealistic-natural, product-mockup, ui-mockup, infographic-diagram, scientific-educational, ads-marketing, productivity-visual, logo-brand, illustration-story, stylized-concept, historical-scene.
Edit: text-localization, identity-preserve, precise-object-edit, lighting-weather, background-extraction, style-transfer, compositing, sketch-to-render.
Reference map
- reference/CLI.md: script flags, models, sizes, aspect ratios, batch JSONL, API key setup.
- reference/TRANSPARENCY.md: chroma-key workflow and validation for cutouts.
- reference/PROMPTING.md: prompt principles and per-use-case tips.
- reference/SAMPLE-PROMPTS.md: recipes for websites, games, wireframes, logos, edits.
04 同仓库更多 Skills
wait-what
Stop. That last message did not land: re-pitch it.
to-questionnaire
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
teach
Teach the user a new skill or concept, within this workspace.
research
Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.
prototype
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
grilling
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.