Agent Skill
2/7/2026

image-generation

Generate images using Google's Gemini image generation model. Use this skill when users request image creation, artwork generation, visual content creation, or when you need to generate images for any purpose including diagrams, illustrations, concept art, or visual explanations.

U
ujjawal
0GitHub Stars
1Views
npx skills add Ujjawal-Anand/skill-image-gen

SKILL.md

Nameimage-generation
DescriptionGenerate images using Google's Gemini image generation model. Use this skill when users request image creation, artwork generation, visual content creation, or when you need to generate images for any purpose including diagrams, illustrations, concept art, or visual explanations.

name: image-generation description: Generate images using Google's Gemini image generation model. Use this skill when users request image creation, artwork generation, visual content creation, or when you need to generate images for any purpose including diagrams, illustrations, concept art, or visual explanations.

Image Generation Skill

Generate images using Google's Gemini Imagen model. This skill enables you to create images from text descriptions.

Prerequisites

  • Google AI API Key: Set the GOOGLE_API_KEY or GEMINI_API_KEY environment variable
  • Python Dependencies: The script will check and install required packages automatically

Quick Start

To generate an image, run:

python {baseDir}/scripts/generate_image.py --prompt "your image description" --output "output_path.png"

Available Models

List all available models:

python {baseDir}/scripts/generate_image.py --list-models

Available models:

ModelDescription
gemini-2.0-flash-exp-image-generationFast experimental model for quick image generation
gemini-2.5-flash-image-previewFlash preview model with good balance of speed and quality
gemini-2.5-flash-imageStable flash model for image generation
gemini-3-pro-image-previewPro model with high quality output (default, recommended)
imagen-4.0-generate-preview-06-06Imagen 4.0 preview model
imagen-4.0-ultra-generate-preview-06-06Imagen 4.0 ultra preview for highest quality
imagen-4.0-generate-001Imagen 4.0 stable model
imagen-4.0-ultra-generate-001Imagen 4.0 ultra stable for highest quality
imagen-4.0-fast-generate-001Imagen 4.0 fast model for quick generation

Command Options

OptionRequiredDefaultDescription
--promptYes-Text description of the image to generate
--outputNogenerated_image.pngOutput file path (PNG format)
--modelNogemini-3-pro-image-previewModel to use for generation
--aspect-ratioNo1:1Aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4
--negative-promptNo-What to avoid in the generated image
--list-modelsNo-List all available models and exit

Workflows

Basic Image Generation

Generate a simple image from a text prompt:

python {baseDir}/scripts/generate_image.py --prompt "A serene mountain landscape at sunset with a calm lake in the foreground"

Select a Specific Model

Choose a model based on your needs:

# Use the fast model for quick iterations
python {baseDir}/scripts/generate_image.py --prompt "A sunset" --model "imagen-4.0-fast-generate-001"

# Use the ultra model for highest quality
python {baseDir}/scripts/generate_image.py --prompt "A detailed portrait" --model "imagen-4.0-ultra-generate-001"

# Use the default pro model (recommended)
python {baseDir}/scripts/generate_image.py --prompt "A landscape" --model "gemini-3-pro-image-preview"

Custom Output Path

Save the image to a specific location:

python {baseDir}/scripts/generate_image.py --prompt "A futuristic city skyline" --output "/path/to/my_image.png"

Specific Aspect Ratio

Generate images with different aspect ratios for various use cases:

# Widescreen (16:9) - good for headers, banners
python {baseDir}/scripts/generate_image.py --prompt "Abstract geometric patterns" --aspect-ratio "16:9"

# Portrait (9:16) - good for mobile, stories
python {baseDir}/scripts/generate_image.py --prompt "A tall lighthouse at night" --aspect-ratio "9:16"

# Standard photo (4:3)
python {baseDir}/scripts/generate_image.py --prompt "A cozy coffee shop interior" --aspect-ratio "4:3"

Using Negative Prompts

Exclude unwanted elements from the generated image:

python {baseDir}/scripts/generate_image.py --prompt "A beautiful garden with flowers" --negative-prompt "people, animals, buildings"

Best Practices for Prompts

Be Specific and Descriptive

  • Bad: "a cat"
  • Good: "A fluffy orange tabby cat sitting on a windowsill, soft morning light, photorealistic style"

Include Style Information

  • Specify art style: "digital art", "oil painting", "watercolor", "photorealistic", "anime style"
  • Mention lighting: "soft diffused light", "dramatic shadows", "golden hour"
  • Add mood/atmosphere: "serene", "mysterious", "vibrant", "moody"

Composition Details

  • Describe viewpoint: "bird's eye view", "close-up", "wide angle"
  • Mention subjects and their arrangement
  • Include background details

Example Use Cases

Technical Diagrams

python {baseDir}/scripts/generate_image.py --prompt "A clean, minimal flowchart showing data processing pipeline, white background, professional technical illustration style" --aspect-ratio "16:9"

Concept Art

python {baseDir}/scripts/generate_image.py --prompt "Concept art of a steampunk airship, intricate brass machinery, billowing steam, cloudy sky background, detailed illustration"

Icons and Graphics

python {baseDir}/scripts/generate_image.py --prompt "A minimal flat design icon of a rocket ship, single color on transparent background, vector style" --aspect-ratio "1:1"

Photographs

python {baseDir}/scripts/generate_image.py --prompt "Professional product photography of a sleek smartphone on a marble surface, soft studio lighting, high-end commercial style"

Output

The script outputs:

  1. The generated image saved to the specified path
  2. A JSON response with generation details:
    • success: Whether generation succeeded
    • output_path: Absolute path to the saved image
    • prompt: The prompt used
    • model: The model used for generation
    • aspect_ratio: The aspect ratio used
    • message: Status message or error details

Error Handling

Common errors and solutions:

ErrorSolution
"API key not found"Set GOOGLE_API_KEY or GEMINI_API_KEY environment variable
"Unknown model"Use --list-models to see available models
"Invalid aspect ratio"Use one of: 1:1, 16:9, 9:16, 4:3, 3:4
"Content blocked"Modify prompt to avoid restricted content
"Rate limit exceeded"Wait and retry, or check API quota
"Model not available"Try a different model from the available list

Notes

  • Generated images are in PNG format
  • Default model is gemini-3-pro-image-preview (recommended for quality)
  • Use imagen-4.0-fast-generate-001 for quick iterations
  • Use imagen-4.0-ultra-generate-001 for highest quality output
  • For detailed API information, see the reference documentation in references/gemini-api.md
Skills Info
Original Name:image-generationAuthor:ujjawal