Image Generation with Google Gemini

VerifiedSafe

Generate or edit images using Google Gemini API through the nanobanana tool. Support text prompts, image editing, and multiple resolutions.

Sby Skills Guide Bot
ContentBeginner
3/2/2026
Claude CodeCodex
#image-generation#image-editing#gemini#cli#ai-art

Recommended for

Automated summary

This skill wraps the nanobanana script to generate or edit images through Google's Gemini image models, with configurable size, resolution and model.

Strengths

  • Exposes preset aspect ratios (square through 21:9), a choice between Pro and Flash models, and 1K–4K resolutions through simple CLI flags
  • Accepts one or more input images for editing tasks
  • Offers optional Google Search grounding and model-thought output flags
  • Ships a clear troubleshooting checklist for API key, input files and output directory issues

Limitations

  • Requires a GEMINI_API_KEY plus prior installation of google-genai, Pillow and python-dotenv
  • Hard-coded paths under ~/.codex/skills assume a Codex layout and must be adapted elsewhere
  • The skill mostly forwards the prompt, so results depend entirely on prompt and model quality, with no batching or post-processing described
When to use it

Use it when you need a quick image generated or an existing image edited from the terminal via Gemini.

When not to use it

Avoid it when no valid Gemini API key is available or when offline, local image generation is required.

Security analysis

Safe
Quality score88/100

The skill only documents how to run a local Python image-generation script and optionally install its declared Python dependencies. It uses a user-provided GEMINI_API_KEY for the expected Gemini API calls, with no destructive commands, obfuscation, credential exfiltration, or unsafe shell patterns.

No concerns found

How this analysis is made

Examples

Generate a logo
Use nanobanana to generate a minimalist logo for a coffee startup, square 1024x1024, and save it as logo.png
Edit a photo
Edit photo.png with nanobanana: add a rainbow in the sky, and save the result as photo-with-rainbow.png
High-resolution landscape
Generate a 2K, 16:9 futuristic cityscape with flying cars using nanobanana and save it to cityscape.png

name: nanobanana-skill description: 'Generate or edit images using Google Gemini API via nanobanana. Use when the user asks to create, generate, edit images with nanobanana, or mentions image generation/editing tasks.'

Nanobanana Image Generation Skill

Generate or edit images using Google Gemini API through the nanobanana tool.

Requirements

  1. GEMINI_API_KEY: Must be configured in ~/.nanobanana.env or export GEMINI_API_KEY=<your-api-key>
  2. Python3 with depedent packages installed: google-genai, Pillow, python-dotenv. They could be installed via python3 -m pip install -r ~/.codex/skills/nanobanana-skill/requirements.txt if not installed yet.
  3. Executable: ~/.codex/skills/nanobanana-skill/nanobanana.py

Example .nanobanana.env:

GEMINI_API_KEY=sk-dummy

Instructions

For image generation

  1. Ask the user for:

    • What they want to create (the prompt)
    • Desired aspect ratio/size (optional, defaults to 9:16 portrait)
    • Output filename (optional, auto-generates UUID if not specified)
    • Model preference (optional, defaults to gemini-3-pro-image-preview)
    • Resolution (optional, defaults to 1K)
  2. Run the nanobanana script with appropriate parameters:

    python3 ~/.codex/skills/nanobanana-skill/nanobanana.py --prompt "description of image" --output "filename.png"
    
  3. Show the user the saved image path when complete

For image editing

  1. Ask the user for:

    • Input image file(s) to edit
    • What changes they want (the prompt)
    • Output filename (optional)
  2. Run with input images:

    python3 ~/.codex/skills/nanobanana-skill/nanobanana.py --prompt "editing instructions" --input image1.png image2.png --output "edited.png"
    

Available Options

Aspect Ratios (--size)

  • 1024x1024 (1:1) - Square
  • 832x1248 (2:3) - Portrait
  • 1248x832 (3:2) - Landscape
  • 864x1184 (3:4) - Portrait
  • 1184x864 (4:3) - Landscape
  • 896x1152 (4:5) - Portrait
  • 1152x896 (5:4) - Landscape
  • 768x1344 (9:16) - Portrait (default)
  • 1344x768 (16:9) - Landscape
  • 1536x672 (21:9) - Ultra-wide

Models (--model)

  • gemini-3-pro-image-preview (default) - Higher quality
  • gemini-2.5-flash-image - Faster generation

Resolution (--resolution)

  • 1K (default)
  • 2K
  • 4K

Optional Flags

  • --enable-google-search Enable Google Search tool for the model (default: disabled)
  • --include-thoughts Include model thinking in output (default: disabled)

Examples

Generate a simple image

python3 ~/.codex/skills/nanobanana-skill/nanobanana.py --prompt "A serene mountain landscape at sunset with a lake"

Generate with specific size and output

python3 ~/.codex/skills/nanobanana-skill/nanobanana.py \
  --prompt "Modern minimalist logo for a tech startup" \
  --size 1024x1024 \
  --output "logo.png"

Generate landscape image with high resolution

python3 ~/.codex/skills/nanobanana-skill/nanobanana.py \
  --prompt "Futuristic cityscape with flying cars" \
  --size 1344x768 \
  --resolution 2K \
  --output "cityscape.png"

Edit existing images

python3 ~/.codex/skills/nanobanana-skill/nanobanana.py \
  --prompt "Add a rainbow in the sky" \
  --input photo.png \
  --output "photo-with-rainbow.png"

Use faster model

python3 ~/.codex/skills/nanobanana-skill/nanobanana.py \
  --prompt "Quick sketch of a cat" \
  --model gemini-2.5-flash-image \
  --output "cat-sketch.png"

Error Handling

If the script fails:

  • Check that GEMINI_API_KEY is exported or set in ~/.nanobanana.env
  • Verify input image files exist and are readable
  • Ensure the output directory is writable
  • If no image is generated, try making the prompt more specific about wanting an image

Best Practices

  1. Be descriptive in prompts - include style, mood, colors, composition
  2. For logos/graphics, use square aspect ratio (1024x1024)
  3. For social media posts, use 9:16 for stories or 1:1 for posts
  4. For wallpapers, use 16:9 or 21:9
  5. Start with 1K resolution for testing, upgrade to 2K/4K for final output
  6. Use gemini-3-pro-image-preview for best quality, gemini-2.5-flash-image for speed

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/image-generation-with-google-gemini-mm8o52qt' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/image-generation-with-google-gemini-mm8o52qt/download' --output '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md.part' && mv '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md.part' '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Requirements
  1. GEMINI_API_KEY: Must be configured in ~/.nanobanana.env or export GEMINI_API_KEY=<your-api-key>
  2. Python3 with depedent packages installed: google-genai, Pillow, python-dotenv. They could be installed via python3 -m pip install -r ~/.codex/skills/nanobanana-skill/requirements.txt if not installed yet.
  3. Executable: ~/.codex/skills/nanobanana-skill/nanobanana.py

Example .nanobanana.env:

GEMINI_API_KEY=sk-dummy

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md' && test -s '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/nanobanana-skill' && cp -R '.skill-downloads/image-generation-with-google-gemini-mm8o52qt' '.claude/skills/nanobanana-skill'

Codex
test -f '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md' && test -s '.skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/nanobanana-skill' && cp -R '.skill-downloads/image-generation-with-google-gemini-mm8o52qt' '.agents/skills/nanobanana-skill'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/image-generation-with-google-gemini-mm8o52qt'

openskills read 'image-generation-with-google-gemini-mm8o52qt'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/image-generation-with-google-gemini-mm8o52qt/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills