CommunityImagengithub.com

gemini-image

Generate or edit images with Google Gemini image models (Nano Banana family) from any project — concept art, character turnarounds for image-to-3D, textures, icons, UI art, references. Use when the user asks to generate, draw or edit an image with Gemini or Nano Banana, or when an asset pipeline step needs a generated image.

¿Qué es gemini-image?

gemini-image is a Claude Code agent skill that generate or edit images with Google Gemini image models (Nano Banana family) from any project — concept art, character turnarounds for image-to-3D, textures, icons, UI art, references. Use when the user asks to generate, draw or edit an image with Gemini or Nano Banana, or when an asset pipeline step needs a generated image.

Compatible con✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/STmihan/gemini-image/tree/HEAD

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

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Gemini image generation

Requirements

  • uv on PATH. It installs Python and the google-genai dependency on the first run.
  • A Gemini API key in the environment variable GEMINI_API_KEY (get one at https://aistudio.google.com/apikey).

Never print, echo, log or write the key's value anywhere; only the script reads it. If it is missing, ask the user to set it themselves in their own terminal and then restart their coding agent, and never to paste it into the chat:

  • Windows (PowerShell): [Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "<key>", "User")
  • macOS / Linux: add export GEMINI_API_KEY="<key>" to ~/.zshrc or ~/.bashrc

Run

Paths are relative to the directory that contains this SKILL.md (<skill-dir> below). Resolve it to an absolute path before running, because the command usually runs from the user's project. uv run --quiet <skill-dir>/scripts/gemini_image.py --help prints every option.

uv run --quiet <skill-dir>/scripts/gemini_image.py \
  --model gemini-3.1-flash-image --aspect 1:1 --size 1K \
  --out <project>/art/<name>.png \
  --prompt "..."
  • --model (required): see the table below.
  • --aspect (required): 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9.
  • --size (required): output resolution, 1K, 2K or 4K (uppercase K). It sets the pixel area (about 1024², 2048² or 4096²), and --aspect sets the shape, so the long side is larger than the nominal size for wide images: 2K at 1:1 is 2048×2048, 2K at 16:9 came out 2752×1536. Pick it from the user's request ("4K", "high resolution", "for print"); for drafts and iterations use 1K, for final assets and image-to-3D input use 2K, and use 4K only when asked, since bigger images cost more and take longer. If a model refuses a size, say so and retry with a supported one only with the user's OK.
  • --out (required): output path. The extension is replaced by the one matching the returned MIME type (Gemini often returns JPEG, so x.png may be saved as x.jpg). Extra images are saved as <out>_1, <out>_2, ...
  • --prompt or --prompt-file (UTF-8 text, better for long prompts; keep prompt files next to the outputs so results are reproducible).
  • --ref <image> (repeatable): reference images for editing, style matching or keeping a character consistent.

The script prints saved <path> for each image and any text the model returns. It retries rate limits and server errors with exponential backoff and exits non-zero with a clear message when the key is missing, an input file does not exist, the API rejects the request or no image comes back. Look at the result with the Read tool before reporting.

Models (verify with client.models.list() if a name fails)

ModelNameUse
gemini-3.1-flash-imageNano Banana 2Default: good quality, fast, cheap.
gemini-3.1-flash-lite-imageNano Banana 2 LiteMany cheap drafts.
gemini-nano-banana-2.1Nano Banana 2.1Newer flash tier; try when 2 misses detail.
gemini-3-pro-imageNano Banana ProHighest quality, text rendering, complex scenes; slower and pricier.
gemini-2.5-flash-imageNano BananaLegacy.

Prompts for 3D pipelines

For image-to-3D (Meshy and similar): a single subject, full body in frame, neutral A-pose or T-pose for characters, orthographic-looking front view, plain light grey background, even soft lighting, no cast shadows, no props cut off by the frame. For multi-view input, generate the front first, then pass it as --ref and ask for the side and back views in the same style.

Skills relacionados