Gemini 2.5 Flash Image Preview supports multiple types of image editing.
Image editing
Gemini 2.5 Flash Image's public preview for image generation
(gemini-2.5-flash-image-preview
) supports the ability to edit
images in addition generating them. With this public preview release,
Gemini 2.5 Flash Image supports improved editing of images and
multi-turn editing and contains updated safety filters that provide a more
flexible and less restrictive user experience.
It supports the following modalities and capabilities:
Image editing (text and image to image)
- Example prompt: "Edit this image to make it look like a cartoon"
- Example prompt: [image of a cat] + [image of a pillow] + "Create a cross stitch of my cat on this pillow."
Multi-turn image editing (chat)
- Example prompts: [upload an image of a blue car.] "Turn this car into a convertible." "Now change the color to yellow." "Add a spoiler."
Edit an image
Console
To edit images:
- Open Vertex AI Studio > Create prompt.
-
Click Switch model and select
gemini-2.5-flash-image-preview
from the menu. - In the Outputs panel, select Image and text from the drop-down menu.
- Click Insert media ( ) and select a source from the menu, then follow the dialog's instructions.
- Write what edits you want to make to the image in the Write a prompt text area.
- Click the Prompt ( ) button.
Gemini will generate an edited version of the provided image based on your description. This process should take a few seconds, but may be comparatively slower depending on capacity.
Python
Install
pip install --upgrade google-genai
To learn more, see the SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values # with appropriate values for your project. export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT export GOOGLE_CLOUD_LOCATION=global export GOOGLE_GENAI_USE_VERTEXAI=True
REST
Run the following command in the terminal to create or overwrite this file in the current directory:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://${API_ENDPOINT}:generateContent \
-d '{
"contents": {
"role": "USER",
"parts": [
{"file_data": {
"mime_type": "image/jpg",
"file_uri": "<var>FILE_NAME</var>"
}
},
{"text": "Convert this photo to black and white, in a cartoonish style."},
]
},
"generation_config": {
"response_modalities": ["TEXT", "IMAGE"],
},
"safetySettings": {
"method": "PROBABILITY",
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
}' 2>/dev/null >response.json
Gemini will generate an image based on your description. This process should take a few seconds, but may be comparatively slower depending on capacity.
Multi-turn image editing
Gemini 2.5 Flash Image Preview also supports improved multi-turn editing, allowing you to respond to the model with changes after receiving an edited image response. This will allow you to continue to make edits to the image conversationally.
Note that is recommended to limit the entire request file size to 50MB maximum.
To test out multi-turn image editing, try our Gemini 2.5 Flash Image Preview notebook.