Génération d'images Nano Banana

VérifiéSûr

Génère et édite des images avec les modèles Gemini de Google. Utilisez des invites textuelles pour créer des visuels, infographies ou éditer des photos existantes.

Spar Skills Guide Bot
ContenuDébutant
0023/07/2026
Claude Code
#image-generation#image-editing#gemini#ai-art#cli

Recommandé pour

Notre avis

Génère et édite des images via l'API Gemini Image de Google (Nano Banana) en ligne de commande.

Points forts

  • Génération rapide avec le modèle Nano Banana standard
  • Édition d'images existante (remplacement d'arrière-plan, modification de contenu)
  • Support du modèle Pro pour des visuels de qualité professionnelle
  • Utilisation simple via uv, sans installation manuelle

Limites

  • Nécessite une clé API Gemini et une connexion Internet
  • Coût par image (environ $0,039 pour Nano Banana)
  • La qualité dépend du modèle choisi et du prompt
Quand l'utiliser

Idéal pour créer rapidement des visuels, des infographies ou modifier des images sans outil graphique complexe.

Quand l'éviter

À éviter pour des montages photo très précis ou des retouches professionnelles nécessitant un logiciel de bureau.

Analyse de sécurité

Sûr
Score qualité92/100

The skill instructs running a Python script that uses a local API key to call Google's Gemini API for image generation. No destructive commands, exfiltration, or obfuscation present. The script is not provided, but assuming it follows the instructions, it is safe.

Aucun point d'attention détecté

Exemples

Generate a futuristic cityscape
Generate an image of a futuristic city at sunset with flying cars and neon lights.
Edit an image background
Edit this image: change the background to a beach sunset. The image is at /path/to/photo.jpg.
Create an infographic
Create an infographic about renewable energy sources using the Pro model.

name: nano-banana-imagegen description: Generate and edit images using Google's Nano Banana (Gemini Image API). Use when the user wants to create AI-generated images, edit existing images, create infographics, generate product mockups, design social media graphics, or perform any image generation/manipulation task. Requires GEMINI_API_KEY environment variable.

Nano Banana Image Generation

Generate and edit images using Google's Gemini Image models (Nano Banana and Nano Banana Pro).

Prerequisites

  1. API Key: Set the GEMINI_API_KEY environment variable

    • Get key from: https://aistudio.google.com/apikey
  2. uv: The script uses inline dependencies with uv (no manual install needed)

Quick Start

Using the Script

# Generate an image
uv run scripts/generate_image.py "A futuristic city at sunset" -o city.png

# Edit an existing image
uv run scripts/generate_image.py "Remove the background" -i photo.jpg -o edited.png

# Use Nano Banana Pro for higher quality
uv run scripts/generate_image.py "Create a detailed infographic" -m pro -o infographic.png

Direct Python Usage (with uv)

uv run --with google-genai python -c '
from google import genai
import os

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

response = client.models.generate_content(
    model="gemini-2.5-flash-image",
    contents=["Create an image of a cat wearing a space helmet"]
)

for part in response.candidates[0].content.parts:
    if part.inline_data:
        with open("output.png", "wb") as f:
            f.write(part.inline_data.data)
        print("Saved to output.png")
'

Model Selection

| Model | Use Case | |-------|----------| | gemini-2.5-flash-image (Nano Banana) | Fast generation, iterations, high volume | | gemini-3-pro-image-preview (Nano Banana Pro) | Professional quality, text rendering, complex prompts |

Common Tasks

Image Generation

uv run scripts/generate_image.py "A serene Japanese garden with cherry blossoms" -o garden.png

Image Editing

uv run scripts/generate_image.py "Change the background to a beach sunset" -i input.jpg -o edited.png

Infographics (use Pro model)

uv run scripts/generate_image.py "Create an infographic about renewable energy" -m pro -o infographic.png

Resources

  • Script: scripts/generate_image.py - CLI tool with inline uv dependencies
  • API Reference: See references/api_reference.md for detailed SDK usage
  • Prompting Guide: See references/prompting_guide.md for effective prompts

Pricing

~$0.039 per image for Nano Banana (1290 tokens per image at $30/1M tokens)

Skills similaires