Gemini Image Generator

This skill should be used when the user asks to "generate an image", "create project images", "make illustrations", "generate icons", "create visual assets", "use Gemini for images", "generate with nono banana", or needs AI-generated images for their project using Google's Gemini API.

$ Installieren

git clone https://github.com/majiayu000/claude-skill-registry /tmp/claude-skill-registry && cp -r /tmp/claude-skill-registry/skills/data/gemini-image-generator ~/.claude/skills/claude-skill-registry

// tip: Run this command in your terminal to install the skill


name: Gemini Image Generator description: This skill should be used when the user asks to "generate an image", "create project images", "make illustrations", "generate icons", "create visual assets", "use Gemini for images", "generate with nono banana", or needs AI-generated images for their project using Google's Gemini API. version: 0.1.0

Gemini Image Generator

Generate high-quality images for projects using Google's Gemini 3 Pro Image Preview model. This skill provides workflows for creating various types of project images including icons, illustrations, banners, and concept art.

Overview

The Gemini 3 Pro Image Preview model (gemini-3-pro-image-preview) offers native image generation capabilities through the Generative Language API. It supports:

  • Text-to-image generation
  • Image editing and transformation
  • Style transfer
  • Multi-image composition

Prerequisites

Before using this skill:

  1. Obtain a Gemini API key from Google AI Studio
  2. Set the environment variable: export GEMINI_API_KEY="your-api-key"

Quick Start

Generate Image via Python Script

Execute the bundled script to generate images:

python3 "${SKILL_DIR}/scripts/generate_image.py" \
  --prompt "A cute banana character mascot for a mobile app, kawaii style, yellow and brown colors" \
  --output "./generated_image.png"

Generate Image via cURL

For direct API calls without dependencies:

curl -s -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent?key=${GEMINI_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "parts": [{"text": "Your prompt here"}]
    }],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"]
    }
  }' | python3 -c "
import sys, json, base64
data = json.load(sys.stdin)
for part in data.get('candidates', [{}])[0].get('content', {}).get('parts', []):
    if 'inlineData' in part:
        img_data = base64.b64decode(part['inlineData']['data'])
        with open('output.png', 'wb') as f:
            f.write(img_data)
        print('Image saved to output.png')
"

Image Generation Workflows

Workflow 1: Project Icon Generation

Generate app icons or project logos:

python3 "${SKILL_DIR}/scripts/generate_image.py" \
  --prompt "Modern flat design app icon for [PROJECT_TYPE], minimalist style, vibrant colors, suitable for iOS/Android" \
  --output "./icon.png" \
  --aspect-ratio "1:1"

Workflow 2: Banner/Hero Image

Create marketing banners or hero images:

python3 "${SKILL_DIR}/scripts/generate_image.py" \
  --prompt "Professional banner image for [PROJECT_NAME], modern tech aesthetic, gradient background" \
  --output "./banner.png" \
  --aspect-ratio "16:9"

Workflow 3: Illustration Generation

Generate illustrations for documentation or UI:

python3 "${SKILL_DIR}/scripts/generate_image.py" \
  --prompt "Clean vector-style illustration showing [CONCEPT], soft colors, professional look" \
  --output "./illustration.png"

Workflow 4: Image Editing/Transformation

Transform or edit existing images:

python3 "${SKILL_DIR}/scripts/generate_image.py" \
  --prompt "Transform this image into a watercolor painting style while preserving the main subject" \
  --input "./source_image.png" \
  --output "./transformed.png"

Prompt Engineering Tips

Effective Prompt Structure

[Subject] + [Style] + [Details] + [Technical specs]

Example:

A friendly robot mascot (subject)
in pixel art style (style)
with blue and orange colors, waving hand (details)
on transparent background, 512x512 resolution (technical)

Style Keywords

CategoryKeywords
Art Styleminimalist, flat design, 3D render, watercolor, pixel art, vector, cartoon
Moodprofessional, playful, elegant, modern, vintage, futuristic
Qualityhigh detail, photorealistic, clean lines, sharp edges
Colorsvibrant, pastel, monochrome, gradient, neon

Project-Specific Prompts

For different project types:

  • Mobile App: "Modern app icon, rounded corners, gradient background, single symbolic element"
  • Web Dashboard: "Clean UI illustration, data visualization theme, blue corporate colors"
  • Game: "Game asset sprite, detailed pixel art, fantasy theme, transparent background"
  • Documentation: "Technical diagram style, clean vector illustration, explanatory visual"

Configuration Options

Aspect Ratios

RatioUse Case
1:1App icons, profile pictures
16:9Banners, hero images
4:3Standard images, thumbnails
9:16Mobile stories, vertical banners
5:4Group photos, presentations

Image Sizes

SizeDescription
defaultStandard resolution
2KHigher quality (2048px)
4KMaximum quality (4096px)

Error Handling

Common issues and solutions:

ErrorCauseSolution
401 UnauthorizedInvalid API keyVerify GEMINI_API_KEY is set correctly
400 Bad RequestInvalid promptCheck prompt format, remove prohibited content
429 Rate LimitedToo many requestsWait and retry, implement backoff
Safety BlockContent policy violationModify prompt to comply with guidelines

Bundled Resources

Scripts

  • scripts/generate_image.py - Main image generation script with full configuration options
  • scripts/batch_generate.py - Generate multiple images from a prompt list

References

  • references/api-reference.md - Complete Gemini API documentation
  • references/prompt-templates.md - Ready-to-use prompt templates for various project types

Examples

  • examples/generate_icon.sh - Example: Generate app icon
  • examples/generate_banner.sh - Example: Generate project banner
  • examples/batch_config.json - Example: Batch generation configuration

Best Practices

  1. Be Specific: Include detailed descriptions of desired output
  2. Specify Style: Always mention the artistic style explicitly
  3. Define Colors: List specific colors when brand consistency matters
  4. Set Constraints: Specify aspect ratio and size requirements upfront
  5. Iterate: Generate multiple variations and refine prompts based on results
  6. Save Prompts: Document successful prompts for future consistency

Integration Notes

When integrating generated images into projects:

  1. Check image dimensions match target requirements
  2. Verify file format compatibility (PNG recommended for transparency)
  3. Consider compression for web assets
  4. Store original prompts alongside images for reproducibility