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...
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.
The Gemini 3 Pro Image Preview model (gemini-3-pro-image-preview) offers native image generation capabilities through the Generative Language API. It supports:
Before using this skill:
export GEMINI_API_KEY="your-api-key"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"
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')
"
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"
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"
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"
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"
[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)
| Category | Keywords |
|---|---|
| Art Style | minimalist, flat design, 3D render, watercolor, pixel art, vector, cartoon |
| Mood | professional, playful, elegant, modern, vintage, futuristic |
| Quality | high detail, photorealistic, clean lines, sharp edges |
| Colors | vibrant, pastel, monochrome, gradient, neon |
For different project types:
| Ratio | Use Case |
|---|---|
| 1:1 | App icons, profile pictures |
| 16:9 | Banners, hero images |
| 4:3 | Standard images, thumbnails |
| 9:16 | Mobile stories, vertical banners |
| 5:4 | Group photos, presentations |
| Size | Description |
|---|---|
| default | Standard resolution |
| 2K | Higher quality (2048px) |
| 4K | Maximum quality (4096px) |
Common issues and solutions:
| Error | Cause | Solution |
|---|---|---|
| 401 Unauthorized | Invalid API key | Verify GEMINI_API_KEY is set correctly |
| 400 Bad Request | Invalid prompt | Check prompt format, remove prohibited content |
| 429 Rate Limited | Too many requests | Wait and retry, implement backoff |
| Safety Block | Content policy violation | Modify prompt to comply with guidelines |
scripts/generate_image.py - Main image generation script with full configuration optionsscripts/batch_generate.py - Generate multiple images from a prompt listreferences/api-reference.md - Complete Gemini API documentationreferences/prompt-templates.md - Ready-to-use prompt templates for various project typesexamples/generate_icon.sh - Example: Generate app iconexamples/generate_banner.sh - Example: Generate project bannerexamples/batch_config.json - Example: Batch generation configurationWhen integrating generated images into projects: