Generate or edit images with the Google Gemini API and Imagen models. Use when Codex needs to handle text-to-image generation, conversational image editing, multi-image grounding, background replacement, product shots, concept art, UI mockups, or model selection between Gemini native image models and Imagen 4 variants; run the bundled CLI (`scripts/gemini_image_gen.py`) and require `GEMINI_API_KEY` for live calls.
インストール
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Generate or edit images with the Google Gemini API and Imagen models. Use when Codex needs to handle text-to-image generation, conversational image editing, multi-image grounding, background replacement, product shots, concept art, UI mockups, or model selection between Gemini native image models and Imagen 4 variants; run the bundled CLI (`scripts/gemini_image_gen.py`) and require `GEMINI_API_KEY` for live calls.
Gemini Image Generation
Generate or edit images for the current project with Google's Gemini API. Default to gemini-3.1-flash-image-preview for most work, switch to gemini-3-pro-image-preview for higher fidelity and more complex instructions, and use imagen-4.0-* when the task is pure text-to-image and benefits from Imagen's specialized generator.
When To Use
Generate a new image for a website, app, game, document, or product concept.
Edit an existing image with prompt-guided changes.
Merge prompt text with one or more reference images.
Choose which current Gemini / Imagen model should handle a generation request.
Batch several image jobs through one local CLI run.
Decision Tree
If the user supplies one or more input images, use a native Gemini image model instead of Imagen.
If the task needs multi-turn refinement, grounded search, or image search grounding, prefer gemini-3.1-flash-image-preview.
If the task needs the highest Gemini-native fidelity, stronger text rendering, or 4K output, prefer gemini-3-pro-image-preview.
If the task is simple and latency-sensitive, prefer gemini-2.5-flash-image.
If the task is pure text-to-image and does not need input-image editing, consider imagen-4.0-generate-001, imagen-4.0-fast-generate-001, or imagen-4.0-ultra-generate-001.
Do not route image-generation work to plain text-output Gemini models such as gemini-2.5-flash or gemini-2.5-pro.
If Python is needed, always run it through uv such as uv run ... or uv run --with ....
Use the Google Gen AI Python SDK (google-genai), not raw HTTP.
For native Gemini image models, use client.models.generate_content(...).
For Imagen models, use client.models.generate_images(...).
If the request includes input images, do not use Imagen in this skill unless the official docs later add edit support and the references are updated.
For complex iterative edits, keep the same Gemini image model through the iteration loop unless the user explicitly wants a quality or latency tradeoff.
Prefer one dry-run first when wiring a new batch or unusual prompt.
Prompt Augmentation
Make implicit production constraints explicit without inventing new creative requirements.
Template:
Use case: <taxonomy slug>
Asset type: <where the asset will be used>
Primary request: <user prompt>
Scene/background: <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>
Text (verbatim): "<exact text>"
Constraints: <must keep / must avoid>
Avoid: <negative constraints>
Rules:
Add only details the user already implied.
Quote exact text that must render.
For edits, repeat the invariants every iteration.
For multi-image prompts, label each reference image by role.
For Imagen, keep the prompt compact and use --negative-prompt when the user clearly asks for exclusions.