mirror of
https://github.com/K-Dense-AI/claude-scientific-skills.git
synced 2026-03-27 07:09:27 +08:00
Use Nano Banana 2
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: generate-image
|
name: generate-image
|
||||||
description: Generate or edit images using AI models (FLUX, Gemini). Use for general-purpose image generation including photos, illustrations, artwork, visual assets, concept art, and any image that is not a technical diagram or schematic. For flowcharts, circuits, pathways, and technical diagrams, use the scientific-schematics skill instead.
|
description: Generate or edit images using AI models (FLUX, Nano Banana 2). Use for general-purpose image generation including photos, illustrations, artwork, visual assets, concept art, and any image that is not a technical diagram or schematic. For flowcharts, circuits, pathways, and technical diagrams, use the scientific-schematics skill instead.
|
||||||
license: MIT license
|
license: MIT license
|
||||||
compatibility: Requires an OpenRouter API key
|
compatibility: Requires an OpenRouter API key
|
||||||
metadata:
|
metadata:
|
||||||
@@ -9,7 +9,7 @@ metadata:
|
|||||||
|
|
||||||
# Generate Image
|
# Generate Image
|
||||||
|
|
||||||
Generate and edit high-quality images using OpenRouter's image generation models including FLUX.2 Pro and Gemini 3 Pro.
|
Generate and edit high-quality images using OpenRouter's image generation models including FLUX.2 Pro and Gemini 3.1 Flash Image Preview.
|
||||||
|
|
||||||
## When to Use This Skill
|
## When to Use This Skill
|
||||||
|
|
||||||
@@ -58,18 +58,18 @@ The script will automatically detect the `.env` file and provide clear error mes
|
|||||||
|
|
||||||
## Model Selection
|
## Model Selection
|
||||||
|
|
||||||
**Default model**: `google/gemini-3-pro-image-preview` (high quality, recommended)
|
**Default model**: `google/gemini-3.1-flash-image-preview` (high quality, recommended)
|
||||||
|
|
||||||
**Available models for generation and editing**:
|
**Available models for generation and editing**:
|
||||||
- `google/gemini-3-pro-image-preview` - High quality, supports generation + editing
|
- `google/gemini-3.1-flash-image-preview` - High quality, supports generation + editing
|
||||||
- `black-forest-labs/flux.2-pro` - Fast, high quality, supports generation + editing
|
- `black-forest-labs/flux.2-pro` - Fast, high quality, supports generation + editing
|
||||||
|
|
||||||
**Generation only**:
|
**Generation only**:
|
||||||
- `black-forest-labs/flux.2-flex` - Fast and cheap, but not as high quality as pro
|
- `black-forest-labs/flux.2-flex` - Fast and cheap, but not as high quality as pro
|
||||||
|
|
||||||
Select based on:
|
Select based on:
|
||||||
- **Quality**: Use gemini-3-pro or flux.2-pro
|
- **Quality**: Use gemini-3.1-flash-image-preview or flux.2-pro
|
||||||
- **Editing**: Use gemini-3-pro or flux.2-pro (both support image editing)
|
- **Editing**: Use gemini-3.1-flash-image-preview or flux.2-pro (both support image editing)
|
||||||
- **Cost**: Use flux.2-flex for generation only
|
- **Cost**: Use flux.2-flex for generation only
|
||||||
|
|
||||||
## Common Usage Patterns
|
## Common Usage Patterns
|
||||||
@@ -115,7 +115,7 @@ python scripts/generate_image.py "Image 2 description" --output image2.png
|
|||||||
|
|
||||||
- `prompt` (required): Text description of the image to generate, or editing instructions
|
- `prompt` (required): Text description of the image to generate, or editing instructions
|
||||||
- `--input` or `-i`: Input image path for editing (enables edit mode)
|
- `--input` or `-i`: Input image path for editing (enables edit mode)
|
||||||
- `--model` or `-m`: OpenRouter model ID (default: google/gemini-3-pro-image-preview)
|
- `--model` or `-m`: OpenRouter model ID (default: google/gemini-3.1-flash-image-preview)
|
||||||
- `--output` or `-o`: Output file path (default: generated_image.png)
|
- `--output` or `-o`: Output file path (default: generated_image.png)
|
||||||
- `--api-key`: OpenRouter API key (overrides .env file)
|
- `--api-key`: OpenRouter API key (overrides .env file)
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ If the script fails, read the error message and address the issue before retryin
|
|||||||
- Be specific about what changes you want (e.g., "change the sky to sunset colors" vs "edit the sky")
|
- Be specific about what changes you want (e.g., "change the sky to sunset colors" vs "edit the sky")
|
||||||
- Reference specific elements in the image when possible
|
- Reference specific elements in the image when possible
|
||||||
- For best results, use clear and detailed editing instructions
|
- For best results, use clear and detailed editing instructions
|
||||||
- Both Gemini 3 Pro and FLUX.2 Pro support image editing through OpenRouter
|
- Both Gemini 3.1 Flash Image Preview and FLUX.2 Pro support image editing through OpenRouter
|
||||||
|
|
||||||
## Integration with Other Skills
|
## Integration with Other Skills
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Generate and edit images using OpenRouter API with various image generation models.
|
Generate and edit images using OpenRouter API with various image generation models.
|
||||||
|
|
||||||
Supports models like:
|
Supports models like:
|
||||||
- google/gemini-3-pro-image-preview (generation and editing)
|
- google/gemini-3.1-flash-image-preview (generation and editing)
|
||||||
- black-forest-labs/flux.2-pro (generation and editing)
|
- black-forest-labs/flux.2-pro (generation and editing)
|
||||||
- black-forest-labs/flux.2-flex (generation)
|
- black-forest-labs/flux.2-flex (generation)
|
||||||
- And more image generation models available on OpenRouter
|
- And more image generation models available on OpenRouter
|
||||||
@@ -74,7 +74,7 @@ def save_base64_image(base64_data: str, output_path: str) -> None:
|
|||||||
|
|
||||||
def generate_image(
|
def generate_image(
|
||||||
prompt: str,
|
prompt: str,
|
||||||
model: str = "google/gemini-3-pro-image-preview",
|
model: str = "google/gemini-3.1-flash-image-preview",
|
||||||
output_path: str = "generated_image.png",
|
output_path: str = "generated_image.png",
|
||||||
api_key: Optional[str] = None,
|
api_key: Optional[str] = None,
|
||||||
input_image: Optional[str] = None
|
input_image: Optional[str] = None
|
||||||
@@ -84,7 +84,7 @@ def generate_image(
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
prompt: Text description of the image to generate, or editing instructions
|
prompt: Text description of the image to generate, or editing instructions
|
||||||
model: OpenRouter model ID (default: google/gemini-3-pro-image-preview)
|
model: OpenRouter model ID (default: google/gemini-3.1-flash-image-preview)
|
||||||
output_path: Path to save the generated image
|
output_path: Path to save the generated image
|
||||||
api_key: OpenRouter API key (will check .env if not provided)
|
api_key: OpenRouter API key (will check .env if not provided)
|
||||||
input_image: Path to an input image for editing (optional)
|
input_image: Path to an input image for editing (optional)
|
||||||
@@ -212,7 +212,7 @@ def main():
|
|||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
epilog="""
|
epilog="""
|
||||||
Examples:
|
Examples:
|
||||||
# Generate with default model (Gemini 3 Pro Image Preview)
|
# Generate with default model (Gemini 3.1 Flash Image Preview)
|
||||||
python generate_image.py "A beautiful sunset over mountains"
|
python generate_image.py "A beautiful sunset over mountains"
|
||||||
|
|
||||||
# Use a specific model
|
# Use a specific model
|
||||||
@@ -228,7 +228,7 @@ Examples:
|
|||||||
python generate_image.py "Add a hat to the person" --input portrait.png -m "black-forest-labs/flux.2-pro"
|
python generate_image.py "Add a hat to the person" --input portrait.png -m "black-forest-labs/flux.2-pro"
|
||||||
|
|
||||||
Popular image models:
|
Popular image models:
|
||||||
- google/gemini-3-pro-image-preview (default, high quality, generation + editing)
|
- google/gemini-3.1-flash-image-preview (default, high quality, generation + editing)
|
||||||
- black-forest-labs/flux.2-pro (fast, high quality, generation + editing)
|
- black-forest-labs/flux.2-pro (fast, high quality, generation + editing)
|
||||||
- black-forest-labs/flux.2-flex (development version)
|
- black-forest-labs/flux.2-flex (development version)
|
||||||
"""
|
"""
|
||||||
@@ -243,8 +243,8 @@ Popular image models:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--model", "-m",
|
"--model", "-m",
|
||||||
type=str,
|
type=str,
|
||||||
default="google/gemini-3-pro-image-preview",
|
default="google/gemini-3.1-flash-image-preview",
|
||||||
help="OpenRouter model ID (default: google/gemini-3-pro-image-preview)"
|
help="OpenRouter model ID (default: google/gemini-3.1-flash-image-preview)"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
Reference in New Issue
Block a user