Bubble Plugins • Server Actions

Image Generation & Editing for Bubble

Two powerful image generation actions: Gemini for image editing and prompt-based transformations, and Imagen 4 for pure text-to-image generation. No base64 strings to handle!

Overview

This plugin suite provides two complementary server actions for image generation and editing using Google's AI models:

Gemini Nano-Banana Image Image Editing

Generate images from text and edit existing images using Gemini's multimodal capabilities.

  • Text → Image generation
  • Image → Image editing
  • Supports up to 2 input images
  • Prompt-based transformations
Imagen 4 Generate Text-to-Image

Generate high-quality images from text descriptions using Google's dedicated Imagen 4 models.

  • Text → Image generation only
  • Multiple aspect ratios
  • Generate up to 4 images at once
  • Optimized for image quality

Available Actions

Gemini Nano-Banana Image

Purpose: Generate new images or edit existing images using Gemini models

Inputs:

  • model (text): Gemini model (e.g., gemini-2.5-flash-image)
  • prompt (text): Instructions for generation/editing
  • image_single (image, optional): First image to edit/condition on
  • image_2 (image, optional): Second image to edit/combine
  • params_json (text, optional): JSON configuration

Returns:

  • images (list): Bubble image URLs
  • raw_count (number): Number of images produced
  • model (text): Model actually used
  • texts (list): Any text responses

Imagen 4 Generate

Purpose: Generate images from text using Imagen 4 models

Inputs:

  • model (text): Imagen 4 model (e.g., imagen-4.0-generate-001)
  • prompt (text): Image description
  • sample_count (number, optional): Number of images (1-4, default 1)
  • aspect_ratio (text, optional): Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4)

Returns:

  • urls (list): Bubble file URLs for generated images
  • raw_count (number): Count of images produced
  • model (text): Model actually used
  • generation_time (number): Time taken in milliseconds

Setup in Bubble

Important: Both actions use the same API key setup. You only need to configure this once.
  1. Install the plugin in your Bubble app.
  2. Open the plugin's Keys tab and add your Google AI Studio API key:
    • GOOGLE_API_KEY → your key from Google AI Studio
  3. In your workflow, choose the appropriate action:
    • Gemini Nano-Banana Image for image editing or multimodal generation
    • Imagen 4 Generate for pure text-to-image generation
  4. Configure the action inputs (see Usage section)
  5. Use the returned fields in later workflow steps
Both actions automatically upload generated images to Bubble storage. If upload APIs are unavailable, they return data: URLs as fallback.

Usage Guide

Gemini Nano-Banana Image

Generate (Text → Image)

Edit (Image → Image)

Imagen 4 Generate

Basic Generation

Advanced Options

Model Support

Gemini Models

Supported: gemini-2.5-flash-image and gemini-2.5-flash-image-preview
Not supported: Other Gemini models without image capabilities

Imagen 4 Models

Supported:
  • imagen-4.0-generate-001 - Standard quality
  • imagen-4.0-ultra-generate-001 - Ultra quality
  • imagen-4.0-fast-generate-001 - Fast generation
Not supported: Older Imagen versions or non-generate models
Choosing between actions:
  • Use Gemini for image editing, transformations, or when you need to reference existing images
  • Use Imagen 4 for pure text-to-image generation with potentially higher quality

Troubleshooting

Common Issues

Billing & Limits (Google AI Studio)

Free tier limits: If you see errors or missing results, you may have hit the free tier cap for the Gemini API. Nano Banana features may require the pay-as-you-go plan.

Upgrade your Google AI Studio project to pay-as-you-go (Tier 1):

  1. Open Google AI Studio → API Keys.
  2. Find the project you want to upgrade and click Set up billing.
  3. Link a Google Cloud billing account when prompted.
  4. After billing is enabled, your project is on pay-as-you-go. Current pricing for image generation is about $0.039 per image (charged by Google).

After enabling billing, retry your request. If issues persist, verify model names and check AI Studio's Usage & Billing page for quota errors.

Action-Specific Issues

Gemini Issues

Imagen 4 Issues