nanobanana_edit_image
Edit images by describing changes with text prompts. Add, remove, or modify elements, adjust styles, lighting, colors, composition, and apply effects while maintaining the original image's context.
Instructions
Edit an existing image using text prompts with Google's Nano Banana models.
Provide an image and describe your desired changes. The model will:
Add, remove, or modify elements
Change style, lighting, or colors
Adjust composition
Apply filters or effects
The model maintains the original image's style and context while applying changes.
Args:
prompt (string, required): Description of the edit to make
image_base64 (string, required): Base64-encoded image data (no data URI prefix)
image_mime_type (string, required): MIME type of the image (e.g., 'image/png', 'image/jpeg')
model (string): Model to use. Default: Nano Banana Pro
aspect_ratio (string): Output aspect ratio. Options: 1:1, 2:3, 3:2, etc.
resolution (string): Output resolution (Pro only). Options: 1K, 2K, 4K
Returns:
success (boolean): Whether editing succeeded
imageData (string): Base64-encoded edited image
mimeType (string): Image MIME type
text (string): Any accompanying text from the model
error (string): Error message if editing failed
Examples:
"Add a small wizard hat on the cat's head"
"Change the background to a sunset beach"
"Make this image look like a Van Gogh painting"
"Remove the person in the background"
Error Handling:
Returns error if image data is invalid
Returns error if MIME type is unsupported
Returns error if content policy violated
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Text description of the edit to make. Describe what to add, remove, or modify. Be specific about the desired changes. | |
| image_base64 | Yes | Base64-encoded image data to edit. Do not include data URI prefix. | |
| image_mime_type | Yes | MIME type of the image. Supported: image/png, image/jpeg, image/jpg, image/gif, image/webp | |
| model | No | Model to use. 'gemini-3-pro-image-preview' (Nano Banana Pro) for best quality and features, 'gemini-2.5-flash-image' (Nano Banana) for faster generation. Default: Nano Banana Pro | gemini-3-pro-image-preview |
| aspect_ratio | No | Aspect ratio of the generated image. Options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. Default: varies by prompt | |
| resolution | No | Resolution of the generated image (Nano Banana Pro only). Options: 1K, 2K, 4K. Note: Must use uppercase 'K'. Default: 1K |