Save images in Gemini

Why does Gemini recreate the image when saving? Why can’t I just load the generated image. The new version of the image does not differ significantly 5-10%. If you just need an image for background, it’s not a big deal, but when you need the correct positioning of objects, it spoils the AI experience. I don’t have time to check the generated image with the saved image every time. If I clicked save, that’s the result I should get.

Here’s just an example. Images of a city. On the left, what Gemini showed. On the right, after saving.

And Gemini doesn’t allow you to revert to past versions of an image after reloading the page.

Hi @Vanya , Welcome to the forum.

Are you referring to the imagen-3.0-generate-002 model? I just checked, and it doesn’t seem to recreate new image after saving. If possible, could you share sample code that I can reproduce on my end?

This is the web version of Gemini. Sometimes it changes 5% and sometimes it changes20%. The bad thing is that it can change the facial expression. Show a good result, and recreate one I don’t want.

So you are referring to the gemini-2.0-flash-exp-image-gen model. I tried running the code below, and I noticed that the displayed image and the saved image are identical.

from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
import base64

client = genai.Client(api_key="GOOGLE_API_KEY")

contents = ('Images of a city')

response = client.models.generate_content(
    model="gemini-2.0-flash-exp-image-generation",
    contents=contents,
    config=types.GenerateContentConfig(
      response_modalities=['Text', 'Image']
    )
)

for part in response.candidates[0].content.parts:
  if part.text is not None:
    print(part.text)
  elif part.inline_data is not None:
    image = Image.open(BytesIO((part.inline_data.data)))
    image.save('city.png')
    image.show()

I’m not talking about the API, I’m talking about gemini.google.com. Generation when saving can change the position of the object, different position of arms or legs and emotion on the face.