Skip to content

Image Editing ​

Edit images using natural language instructions without re-uploading or specifying complex parameters.

Editing Methods ​

1. Continue Editing (Conversational) ​

Edit the last image in your session without specifying which one:

[After generating an image]
Add some clouds in the sky
Make it more dramatic
Remove the person on the left

This is the most natural way to iterate on images.

2. Edit by ID ​

Edit a specific image by its database ID:

Edit image #42: Add a rainbow in the background

Useful when you want to edit an older image, not the most recent one.

3. Upload and Edit ​

Upload an image from a URL and edit it:

Upload this image: https://example.com/photo.jpg
Now add a sunset filter

Two-step process:

  1. upload_image_for_editing - Downloads and stores the image
  2. edit_uploaded_image - Applies your edits

What You Can Edit ​

Add Elements ​

Add a rainbow in the sky
Add some birds flying
Add a person walking in the distance
Add reflections in the water

Remove Elements ​

Remove the car from the scene
Remove the text/watermark
Remove the people in the background
Remove the clouds

Change Properties ​

Make the sky darker
Make it look like sunset
Change the grass to autumn colors
Make it more vibrant

Style Transfer ​

Make it look like a watercolor painting
Apply a vintage film look
Convert to black and white
Make it look like anime

Lighting Adjustments ​

Add dramatic lighting
Make it golden hour lighting
Add rim lighting to the subject
Create a backlit silhouette effect

Edit Limitations ​

What Editing Can't Do

  • Change composition: Can't zoom in/out or reframe
  • Change aspect ratio: Significant changes may cause issues
  • Reposition subjects: Major movement of elements
  • Change perspective: Can't rotate the viewpoint

For these changes, generate a new image instead.

Edit Workflow ​

Edit Workflow

Continue editing, fetch by ID, or upload - with Gemini cache optimization

Edit Lineage ​

Every edit creates a new image linked to its parent:

Edit Lineage

Version history with branching from any point

Benefits:

  • Version history: See how an image evolved
  • Non-destructive: Original always preserved
  • Branching: Create variations from any point

Best Practices ​

Be Specific ​

❌ "Make it better" ✅ "Increase the contrast and add warmer tones"

❌ "Add something interesting" ✅ "Add a hot air balloon in the distance"

Work Incrementally ​

Instead of:

Add clouds, birds, a rainbow, make it sunset, and add lens flare

Do:

Add dramatic clouds in the sky
→ [Review result]
Add some birds flying in formation
→ [Review result]
Add warm sunset colors to the sky
→ [Review result]

Use Negative Prompts ​

Add a mystical fog effect
Avoid: completely obscuring the subject, too dark

Describe Context ​

Add reflections of the mountains in the lake water

Better than:

Add reflections

Editing Examples ​

Portrait Enhancement ​

Original: A portrait photo
Edit 1: Soften the background blur
Edit 2: Add subtle rim lighting
Edit 3: Enhance the eye catchlights
Edit 4: Add a gentle warm color grade

Landscape Transformation ​

Original: A daytime mountain scene
Edit 1: Change to sunset lighting
Edit 2: Add dramatic clouds
Edit 3: Add mist in the valleys
Edit 4: Add a reflection lake in the foreground

Product Shot Refinement ​

Original: Product on white background
Edit 1: Add soft shadows
Edit 2: Add subtle reflection
Edit 3: Add depth by blurring background slightly
Edit 4: Add professional lighting highlights

Session State ​

The session tracks your editing context:

FieldPurpose
last_image_idMost recent image for continue_editing
total_imagesCount of images in session
total_editsCount of edit operations

When you use continue_editing, it automatically uses last_image_id.

Gemini File Caching ​

For faster edits, Go Bananas! caches images in Gemini's Files API:

ScenarioBehavior
Edit within 48 hoursUses cached file (fast)
Edit after 48 hoursRe-uploads from R2 (slower)
Edit uploaded imageCreates new cache entry

You don't need to manage this - it's automatic.

API Details ​

Continue Editing ​

json
{
  "tool": "continue_editing",
  "params": {
    "prompt": "Add clouds in the sky",
    "negative_prompt": "cartoon, unrealistic"
  }
}

Edit by ID ​

json
{
  "tool": "edit_image",
  "params": {
    "image_id": 42,
    "prompt": "Make it sunset lighting"
  }
}

Upload for Editing ​

json
{
  "tool": "upload_image_for_editing",
  "params": {
    "image_url": "https://example.com/photo.jpg"
  }
}

Then:

json
{
  "tool": "edit_uploaded_image",
  "params": {
    "image_id": 123,
    "edit_prompt": "Add a vintage filter"
  }
}

Next Steps ​

Released under the MIT License.