Skip to main content
POST
Image to Image Edit

Overview

Nano Banana 2 can restyle or surgically modify a reference image while maintaining global composition. Provide up to 14 reference images (10 object + 4 character) plus a short instructionβ€”Nano Banana 2’s upgraded diffusion backbone keeps lighting, textures, and edge fidelity intact.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Image to image edit request body

prompt
string
required

Text prompt for image editing. Describe the desired change conversationally.

For adding/removing elements: "Add a wizard hat on the cat's head" For inpainting: "Change only the blue sofa to a brown leather chesterfield" For style transfer: "Transform this photo into Van Gogh's Starry Night style"

images
string[]
required

List of reference images for editing. Supports both image URLs and base64-encoded images.

Base64 format: data:image/png;base64,{base64_data}

Supported formats: JPEG, JPG, PNG, BMP, WEBP Max file size per image: 20MB

Nano Banana 2 supports up to 14 reference images:

  • Up to 10 images of objects (high-fidelity preservation)
  • Up to 4 images of characters (character consistency)
Required array length: 1 - 14 elements
aspect_ratio
enum<string>
default:1:1

Aspect ratio of the edited image (width:height).

Available options:
1:1,
1:4,
1:8,
2:3,
3:2,
3:4,
4:1,
4:3,
4:5,
5:4,
8:1,
9:16,
16:9,
21:9
resolution
enum<string>
default:1K

Output resolution preset.

Note: Must use uppercase K (e.g. 1K, 2K, 4K). Lowercase will be rejected.

Available options:
1K,
2K,
4K

Enable Google Search grounding for image editing. When enabled, the model can use Google Search (including Web Search and Image Search) to verify facts and generate imagery based on real-time data such as current weather, stock charts, recent events, or accurate depictions of real-world subjects.

Response

202 - application/json

Accepted - Task created successfully

task_info
object