skills/gemini-image/SKILL.md
Invoke Google Gemini for image generation and understanding using the Python google-genai SDK. Supports gemini-3-pro-image-preview (generation + understanding), gemini-2.5-flash-image (fast generation), and vision models for analysis.
npx skillsauth add rdfitted/claude-code-setup gemini-imageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Invoke Google Gemini models for image generation, image understanding, and visual analysis using the Python google-genai SDK.
| Model ID | Description | Best For | Output Format |
|----------|-------------|----------|---------------|
| gemini-3-pro-image-preview | Best image generation + understanding | High-quality image gen, complex visual analysis | JPEG |
| gemini-2.5-flash-image | Fast image generation | Quick image creation | PNG |
| gemini-3-pro-preview | Multimodal understanding | Image analysis without generation | N/A |
| gemini-2.5-flash | Fast vision | Quick image analysis | N/A |
API Key: Set via $GEMINI_API_KEY environment variable
python -c "
import os
from google import genai
from google.genai import types
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
response = client.models.generate_content(
model='gemini-3-pro-image-preview', # Returns JPEG | Use gemini-2.5-flash-image for PNG
contents='Generate an image of a sunset over mountains',
config=types.GenerateContentConfig(
response_modalities=['IMAGE', 'TEXT']
)
)
# Map mime types to file extensions
mime_to_ext = {'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif', 'image/webp': '.webp'}
# Save generated image
if response.candidates and response.candidates[0].content:
for part in response.candidates[0].content.parts:
if hasattr(part, 'inline_data') and part.inline_data:
ext = mime_to_ext.get(part.inline_data.mime_type, '.png')
filename = f'output{ext}'
# Data is already raw bytes - no base64 decode needed
with open(filename, 'wb') as f:
f.write(part.inline_data.data)
print(f'Image saved to {filename} ({part.inline_data.mime_type})')
elif hasattr(part, 'text'):
print(part.text)
"
python -c "
import os
from google import genai
from google.genai import types
import base64
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
# Read image file - must be base64 encoded for INPUT
with open('IMAGE_PATH', 'rb') as f:
image_data = base64.b64encode(f.read()).decode('utf-8')
response = client.models.generate_content(
model='gemini-3-pro-preview',
contents=[
types.Content(parts=[
types.Part(text='Describe this image in detail'),
types.Part(inline_data=types.Blob(mime_type='image/png', data=image_data))
])
]
)
print(response.text)
"
python -c "
import os
from google import genai
from google.genai import types
import urllib.request
import base64
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
# Fetch image from URL - must be base64 encoded for INPUT
url = 'IMAGE_URL_HERE'
with urllib.request.urlopen(url) as response:
image_data = base64.b64encode(response.read()).decode('utf-8')
response = client.models.generate_content(
model='gemini-3-pro-preview',
contents=[
types.Content(parts=[
types.Part(text='What is in this image?'),
types.Part(inline_data=types.Blob(mime_type='image/jpeg', data=image_data))
])
]
)
print(response.text)
"
When this skill is invoked:
Determine the task type:
Select the appropriate model:
gemini-3-pro-image-preview (JPEG) or gemini-2.5-flash-image (PNG)gemini-3-pro-preview or gemini-2.5-flashPrepare the input:
Execute and handle output:
python -c "
import os
from google import genai
from google.genai import types
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
response = client.models.generate_content(
model='gemini-3-pro-image-preview',
contents='Create a professional product photo of a sleek wireless headphone on a white background, studio lighting',
config=types.GenerateContentConfig(
response_modalities=['IMAGE', 'TEXT']
)
)
mime_to_ext = {'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif', 'image/webp': '.webp'}
if response.candidates and response.candidates[0].content:
for part in response.candidates[0].content.parts:
if hasattr(part, 'inline_data') and part.inline_data:
ext = mime_to_ext.get(part.inline_data.mime_type, '.png')
with open(f'headphone{ext}', 'wb') as f:
f.write(part.inline_data.data)
print(f'Image saved to headphone{ext}')
"
python -c "
import os
from google import genai
from google.genai import types
import base64
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
with open('screenshot.png', 'rb') as f:
image_data = base64.b64encode(f.read()).decode('utf-8')
response = client.models.generate_content(
model='gemini-3-pro-preview',
contents=[
types.Content(parts=[
types.Part(text='Analyze this UI screenshot. Identify any usability issues and suggest improvements.'),
types.Part(inline_data=types.Blob(mime_type='image/png', data=image_data))
])
]
)
print(response.text)
"
python -c "
import os
from google import genai
from google.genai import types
import base64
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
with open('document.png', 'rb') as f:
image_data = base64.b64encode(f.read()).decode('utf-8')
response = client.models.generate_content(
model='gemini-3-pro-preview',
contents=[
types.Content(parts=[
types.Part(text='Extract all text from this image. Preserve formatting where possible.'),
types.Part(inline_data=types.Blob(mime_type='image/png', data=image_data))
])
]
)
print(response.text)
"
python -c "
import os
from google import genai
from google.genai import types
import base64
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
with open('image1.png', 'rb') as f:
img1_data = base64.b64encode(f.read()).decode('utf-8')
with open('image2.png', 'rb') as f:
img2_data = base64.b64encode(f.read()).decode('utf-8')
response = client.models.generate_content(
model='gemini-3-pro-preview',
contents=[
types.Content(parts=[
types.Part(text='Compare these two images. What are the key differences?'),
types.Part(inline_data=types.Blob(mime_type='image/png', data=img1_data)),
types.Part(inline_data=types.Blob(mime_type='image/png', data=img2_data))
])
]
)
print(response.text)
"
When generating images, you can customize:
config=types.GenerateContentConfig(
response_modalities=['IMAGE', 'TEXT'], # Request both image and description
temperature=1.0, # Higher = more creative
# Additional parameters may be model-specific
)
Input (for understanding):
image/png)image/jpeg)image/gif)image/webp)Output (from generation):
image/png)part.inline_data.data (NOT base64 encoded)part.inline_data.mime_type to determine the actual format returnedCommon errors and solutions:
response_modalities=['IMAGE', 'TEXT'] in configdevelopment
Restore from the Kopia backup repo in one of two opinionated modes. **wikis** (frequent, default) syncs per-project `.ai-docs/` directories from backup to local project trees — used to move compound-knowledge wikis between machines via the backup drive as sneakernet. **full** (rare) restores all sources to original paths for greenfield machine rebuild. Use when the user says "restore wikis", "sync wikis from backup", "pull the wikis", "I plugged in the backup drive on this machine", "rebuild this machine", "greenfield restore", or "restore everything". For ad-hoc single-file restores, use `backup-ops restore` instead.
documentation
# /bp-iterate Iterate the Fitted Business Plan(s). Manages the **internal canonical** and the **external partner/investor variant**, snapshot-on-version-bump lineage, redaction enforcement between variants, and cross-document coupling. ## When this runs - User says `/bp-iterate`, "iterate the BP," "bump the BP," "update the business plan," "version up the BP," "create / update / refresh the external variant" - A material trigger fires per the BP's own Iteration Log (first 2 new closes / fundi
tools
Run Kopia-based backups of key Windows files and config to an external drive. Use when the user says "back up", "run a backup", "snapshot", "the backup drive is plugged in", or wants to set up / configure backups for the first time. Handles initial repo setup, drive detection by volume label, source enumeration, and snapshot creation with structured exclusions.
testing
Secondary backup operations against the Kopia repo — verify integrity, run maintenance/prune, mirror to a second destination, restore files/folders, or run a quick top-up snapshot of hot directories. Use when the user says "verify backups", "check backup integrity", "prune old snapshots", "restore from backup", "mirror backups to cloud", "quick backup", "top up the backup", or asks about backup health. For the primary backup run, use the `backup` skill instead.