Generate and edit images using Google's Nanobanana model via Replicate API. Use this skill when users request image generation from text descriptions, image-to-image transformations, style transfers, or any creative image editing tasks. Supports multiple input images, custom aspect ratios, and various output formats.
Generate and edit images using Google's Nanobanana model via Replicate API. Use this when users request image generation from text, image-to-image transformations, style transfers, or creative editing tasks with custom aspect ratios.
/plugin marketplace add simonlee2/claude-plugins/plugin install creative-tools@simon-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/nanobanana-api.mdscripts/generate_image.pyThis skill enables image generation and editing using Google's Nanobanana model (google/nano-banana) through the Replicate API. Generate images from text prompts, transform existing images, apply style transfers, or create variations with precise control over aspect ratios and output formats.
Generate images from natural language descriptions.
Example requests:
Process:
scripts/generate_image.py with the promptTransform or edit existing images using text prompts.
Example requests:
Process:
scripts/generate_image.py with both prompt and image inputUse multiple images as references or inputs for generation.
Example requests:
Process:
image_input array parameterscripts/generate_image.py with the prompt and multiple image inputsGenerate images with specific dimensions for different use cases.
Available aspect ratios:
1:1 - Square (social media posts, profile pictures)16:9 - Widescreen (presentations, YouTube thumbnails)9:16 - Vertical (mobile stories, TikTok)4:3 - Standard (traditional photos)3:4 - Portrait orientation21:9 - Ultra-wide (cinematic)4:5 - Instagram portrait5:4 - Medium format2:3 - Portrait photos3:2 - Landscape photosmatch_input_image - Match input image dimensions (default when image input provided)Example requests:
The scripts/generate_image.py script handles all Replicate API interactions with proper error handling and polling.
Basic usage:
python scripts/generate_image.py "a sunset over mountains" --output sunset.jpg
With image input:
python scripts/generate_image.py "make this look like a watercolor" \
--image-input https://example.com/photo.jpg \
--output watercolor.jpg
With multiple images:
python scripts/generate_image.py "combine these styles" \
--image-input https://example.com/img1.jpg \
--image-input https://example.com/img2.jpg \
--output combined.jpg
Custom aspect ratio:
python scripts/generate_image.py "a wide landscape" \
--aspect-ratio 21:9 \
--output landscape.jpg
PNG output:
python scripts/generate_image.py "transparent logo concept" \
--output-format png \
--output logo.png
Replicate requires images to be uploaded to their file hosting service. The script automatically handles this:
The script includes comprehensive error handling:
REPLICATE_API_KEY)Generated images are saved to the specified output path. If no output path is specified, the script saves to ./generated_image_{timestamp}.jpg in the current directory.
For detailed information about the Nanobanana model parameters, capabilities, and best practices, refer to references/nanobanana-api.md.
Ensure the REPLICATE_API_KEY environment variable is set:
export REPLICATE_API_KEY="your-api-key-here"
Get an API key from https://replicate.com/account/api-tokens
REPLICATE_API_KEY is not set in the environmentmatch_input_image, ensure at least one input image is provided