generate-image by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill generate-image使用 OpenRouter 的图像生成模型(包括 FLUX.2 Pro 和 Gemini 3 Pro)生成和编辑高质量图像。
在以下情况下使用 generate-image:
在以下情况下请改用 scientific-schematics:
使用 scripts/generate_image.py 脚本来生成或编辑图像:
# 生成新图像
python scripts/generate_image.py "A beautiful sunset over mountains"
# 编辑现有图像
python scripts/generate_image.py "Make the sky purple" --input photo.jpg
这将在当前目录中生成/编辑图像并保存为 generated_image.png。
重要提示:脚本需要 OpenRouter API 密钥。运行前,请检查用户是否已配置其 API 密钥:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
.env 文件.env 文件中是否有 OPENROUTER_API_KEY=<key>OPENROUTER_API_KEY=your-api-key-here 的 .env 文件export OPENROUTER_API_KEY=your-api-key-here脚本将自动检测 .env 文件,并在 API 密钥缺失时提供清晰的错误信息。
默认模型:google/gemini-3-pro-image-preview(高质量,推荐)
可用于生成和编辑的模型:
google/gemini-3-pro-image-preview - 高质量,支持生成 + 编辑black-forest-labs/flux.2-pro - 快速,高质量,支持生成 + 编辑仅用于生成:
black-forest-labs/flux.2-flex - 快速且便宜,但质量不如 pro 版根据以下情况选择:
python scripts/generate_image.py "Your prompt here"
python scripts/generate_image.py "A cat in space" --model "black-forest-labs/flux.2-pro"
python scripts/generate_image.py "Abstract art" --output artwork.png
python scripts/generate_image.py "Make the background blue" --input photo.jpg
python scripts/generate_image.py "Add sunglasses to the person" --input portrait.png --model "black-forest-labs/flux.2-pro"
python scripts/generate_image.py "Remove the text from the image" --input screenshot.png --output cleaned.png
使用不同的提示词或输出路径多次运行脚本:
python scripts/generate_image.py "Image 1 description" --output image1.png
python scripts/generate_image.py "Image 2 description" --output image2.png
prompt(必需):要生成的图像的文本描述,或编辑指令--input 或 -i:用于编辑的输入图像路径(启用编辑模式)--model 或 -m:OpenRouter 模型 ID(默认:google/gemini-3-pro-image-preview)--output 或 -o:输出文件路径(默认:generated_image.png)--api-key:OpenRouter API 密钥(覆盖 .env 文件)# 为论文生成概念性插图
python scripts/generate_image.py "Microscopic view of cancer cells being attacked by immunotherapy agents, scientific illustration style" --output figures/immunotherapy_concept.png
# 为演示文稿创建视觉素材
python scripts/generate_image.py "DNA double helix structure with highlighted mutation site, modern scientific visualization" --output slides/dna_mutation.png
# 标题幻灯片背景
python scripts/generate_image.py "Abstract blue and white background with subtle molecular patterns, professional presentation style" --output slides/background.png
# 海报主图
python scripts/generate_image.py "Laboratory setting with modern equipment, photorealistic, well-lit" --output poster/hero.png
# 网站或文档图片
python scripts/generate_image.py "Professional team collaboration around a digital whiteboard, modern office" --output docs/team_collaboration.png
# 营销材料
python scripts/generate_image.py "Futuristic AI brain concept with glowing neural networks" --output marketing/ai_concept.png
脚本为以下情况提供清晰的错误信息:
如果脚本失败,请阅读错误信息并在重试前解决问题。
images 和 content 响应格式每周安装量
544
代码仓库
GitHub 星标
23.4K
首次出现
Jan 21, 2026
安全审计
安装于
opencode471
gemini-cli453
cursor430
codex427
github-copilot401
claude-code334
Generate and edit high-quality images using OpenRouter's image generation models including FLUX.2 Pro and Gemini 3 Pro.
Use generate-image for:
Use scientific-schematics instead for:
Use the scripts/generate_image.py script to generate or edit images:
# Generate a new image
python scripts/generate_image.py "A beautiful sunset over mountains"
# Edit an existing image
python scripts/generate_image.py "Make the sky purple" --input photo.jpg
This generates/edits an image and saves it as generated_image.png in the current directory.
CRITICAL : The script requires an OpenRouter API key. Before running, check if the user has configured their API key:
.env file in the project directory or parent directoriesOPENROUTER_API_KEY=<key> in the .env file.env file with OPENROUTER_API_KEY=your-api-key-hereexport OPENROUTER_API_KEY=your-api-key-hereThe script will automatically detect the .env file and provide clear error messages if the API key is missing.
Default model : google/gemini-3-pro-image-preview (high quality, recommended)
Available models for generation and editing :
google/gemini-3-pro-image-preview - High quality, supports generation + editingblack-forest-labs/flux.2-pro - Fast, high quality, supports generation + editingGeneration only :
black-forest-labs/flux.2-flex - Fast and cheap, but not as high quality as proSelect based on:
python scripts/generate_image.py "Your prompt here"
python scripts/generate_image.py "A cat in space" --model "black-forest-labs/flux.2-pro"
python scripts/generate_image.py "Abstract art" --output artwork.png
python scripts/generate_image.py "Make the background blue" --input photo.jpg
python scripts/generate_image.py "Add sunglasses to the person" --input portrait.png --model "black-forest-labs/flux.2-pro"
python scripts/generate_image.py "Remove the text from the image" --input screenshot.png --output cleaned.png
Run the script multiple times with different prompts or output paths:
python scripts/generate_image.py "Image 1 description" --output image1.png
python scripts/generate_image.py "Image 2 description" --output image2.png
prompt (required): Text description of the image to generate, or editing instructions--input or -i: Input image path for editing (enables edit mode)--model or -m: OpenRouter model ID (default: google/gemini-3-pro-image-preview)--output or -o: Output file path (default: generated_image.png)--api-key: OpenRouter API key (overrides .env file)# Generate a conceptual illustration for a paper
python scripts/generate_image.py "Microscopic view of cancer cells being attacked by immunotherapy agents, scientific illustration style" --output figures/immunotherapy_concept.png
# Create a visual for a presentation
python scripts/generate_image.py "DNA double helix structure with highlighted mutation site, modern scientific visualization" --output slides/dna_mutation.png
# Title slide background
python scripts/generate_image.py "Abstract blue and white background with subtle molecular patterns, professional presentation style" --output slides/background.png
# Poster hero image
python scripts/generate_image.py "Laboratory setting with modern equipment, photorealistic, well-lit" --output poster/hero.png
# Website or documentation images
python scripts/generate_image.py "Professional team collaboration around a digital whiteboard, modern office" --output docs/team_collaboration.png
# Marketing materials
python scripts/generate_image.py "Futuristic AI brain concept with glowing neural networks" --output marketing/ai_concept.png
The script provides clear error messages for:
If the script fails, read the error message and address the issue before retrying.
images and content response formats from different OpenRouter modelsWeekly Installs
544
Repository
GitHub Stars
23.4K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode471
gemini-cli453
cursor430
codex427
github-copilot401
claude-code334
AI 代码实施计划编写技能 | 自动化开发任务分解与 TDD 流程规划工具
41,400 周安装