Skip to main content

Building with Gemini 2.5 Flash (Nano Banana): A Developer Tutorial

Google for DevelopersSeptember 5, 202510 min88,617 views
6 connections·12 entities in this video→

Getting Started with Nano Banana in AI Studio

  • πŸ’‘ Google AI Studio is the recommended starting point for developers to experiment with Nano Banana (Gemini 2.5 Flash).
  • 🎯 Users can sign up with a Google account to access various models, including Nano Banana, for image creation and editing.
  • πŸ“Έ The platform allows for tasks like restoring and colorizing images, with the ability to download results and continue editing.

Integrating Nano Banana into Applications

  • πŸ”‘ To build with Nano Banana in code, developers need to use the Gemini developer API and official Google AI SDKs.
  • πŸ’° Setting up billing is required, as Nano Banana API usage incurs costs (approximately 4 cents per image).
  • 🐍 The tutorial demonstrates using Python with the google-generativeai SDK, Pillow for image manipulation, and python-dotenv for managing API keys.

Image Generation and Editing with Code

  • πŸ–ΌοΈ The core process involves importing the SDK, setting up a client with an API key (preferably via environment variables), and defining a prompt.
  • πŸš€ Calling client.models.generate_content with the correct model ID (e.g., gemini-2.5-flash-latest) allows for image generation.
  • 🎨 Image editing is achieved by providing an existing image as part of the contents argument in the model call, alongside a new prompt.

Advanced Features: Multiple Inputs and Photo Restoration

  • πŸ‘• Nano Banana supports using multiple input images simultaneously, enabling tasks like compositing elements from different images (e.g., placing a t-shirt onto a person).
  • ⏳ Photo restoration and colorization are highlighted as powerful use cases, requiring a simple prompt like "restore and colorize this image" with optional historical context.

Conversational Image Editing and Best Practices

  • πŸ’¬ Chat sessions can be initiated using client.start_chat for iterative, conversational image editing, mimicking the AI Studio experience.
  • πŸ“ Best practices for effective prompting include being specific, providing context and intent, using step-by-step instructions, and employing positive framing.
  • πŸ”— Further resources, including JavaScript examples and detailed prompting guides, are available via blog posts and GitHub gists linked in the video description.
Knowledge graph12 entities Β· 6 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
12 entities
Chapters5 moments

Key Moments

Transcript40 segments

Full Transcript

Topics13 themes

What’s Discussed

Gemini 2.5 FlashNano BananaGoogle AI StudioGemini APIDeveloper TutorialImage GenerationImage EditingPhoto RestorationConversational AIPrompt EngineeringPython SDKJavaScript ExamplesGoogle DeepMind
Smart Objects12 Β· 6 links
CompanyΒ· 1
ProductsΒ· 6
MediasΒ· 2
ConceptsΒ· 3