| name | generate-image |
| description | This skill should be used when the user asks to "generate an image", "create a picture", "make an image of", "edit this image", "transform this photo", or needs AI-generated visual content using Google's Gemini image generation model. |
| version | 0.2.0 |
Image Generation with Gemini
Generate images using Google's Gemini image generation model via Vertex AI. Supports both text-to-image and image-to-image generation.
Prerequisites
Environment variables (can be in .env file in working directory):
GOOGLE_APPLICATION_CREDENTIALS - Path to service account JSON file
GOOGLE_CLOUD_PROJECT - GCP project ID
Usage
Run the generation script using uvx:
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "PROMPT"
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "PROMPT" -i /path/to/input/image.png
Options
| Flag | Description | Default |
|---|
-i, --input PATH | Input image for image-to-image generation | None |
-o, --output PATH | Where to save the image | Temp file |
--aspect-ratio | "16:9", "1:1", "9:16" | "16:9" |
--size | "1K" or "2K" | "2K" |
Examples
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "A serene mountain landscape at sunset"
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "A cute robot" -o ./robot.png
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "Abstract art" --aspect-ratio 1:1
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "Detailed cityscape" --size 2K
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "Make this scene nighttime with stars" -i ./daytime_photo.jpg
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "Add a rainbow in the sky" -i ./landscape.png -o ./landscape_with_rainbow.png
uvx --with google-genai --with python-dotenv python ~/.claude/skills/generate-image/scripts/generate.py "Convert to watercolor painting style" -i ./photo.jpg
Workflow
- Run the script with user's prompt (and optionally an input image)
- Script prints the saved image path
- Use Read tool to view the generated image
- Move/copy to user-specified location if requested
Batch Generation
Generate multiple images in parallel using the batch script (uv inline script):
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py "A sunset over mountains" "A robot in a garden" "A cat astronaut"
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py --from-file prompts.txt
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py -o ./images "prompt1" "prompt2"
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py -c 2 "prompt1" "prompt2" "prompt3"
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py -f prompts.txt -a 1:1 -s 2K "extra prompt"
uv run ~/.claude/skills/generate-image/scripts/generate_batch.py -i ./photo.jpg "Make it nighttime" "Add rain" "Watercolor style"
Batch Options
| Flag | Description | Default |
|---|
prompts (positional) | One or more text prompts | - |
-f, --from-file PATH | Read prompts from a text file (one per line) | None |
-o, --output-dir DIR | Directory to save images | Temp dir |
-i, --input-image PATH | Input image for image-to-image (all prompts) | None |
-a, --aspect-ratio | "16:9", "1:1", "9:16" | "16:9" |
-s, --size | "1K" or "2K" | "2K" |
-c, --max-concurrent | Max parallel API requests (semaphore) | 4 |
Error Handling
- Missing env vars: Script errors with clear message about which variable is needed
- Input image not found: Script errors if the specified input image path doesn't exist
- Generation failure: Script returns non-zero exit code with error details
- Batch mode: Reports per-prompt success/failure and exits with code 1 if any failed