Gemini-2.5-flash-image-preview aspect ratio and quality

Do any of you know how to support a different aspect ratio using the new nano banana model from google?

For example this JS code doesn’t work:

 const response = await ai.models.generateContent({
    model: "gemini-2.5-flash-image-preview",
    contents: prompt,
    generationConfig: {
      aspectRatio: "16:9",
      numberOfImages: 1,
      // sampleImageSize: "2K",
    },
  });

It always returns a 1:1 Square image, so maybe is not supported yet?

Additionally, is there a way to improve the quality of the images? when I was trying the model it was clear to me that only the first request was a good quality image(with all the details in my prompt), after that the rest of the images generated were garbage, even with the same prompt. And I’m a paying customer, I added the API to my billing in google cloud, so even with that the quality of the images is really bad to be honest, but I don’t know what to do to improve them.

1 Like

@adrianiskandar ,

welcome to the community,

as of now, the model will only provide 1024X1024 px quality images . as for aspect ratio, model should be capable of generating 16:9 aspect ratio if you force it in the prompt, or if give an empty image of that specific aspect ratio , it will try to maintain the specific aspect ratio

1 Like

Thank you @Akhilesh_Kambhampati! using another img as reference helps maintaining the desired aspect ratio. The quality still an issue though, the results I got from gemini. google com/app are considerable better than the ones from the API, I’m still wondering why? I would expect the API would give me at least the same image quality with the same prompt.

1 Like

Are there any plans of making this configurable? I have seen the model fail to adhere to aspect ratio in the prompt.
This feels like a basic feature of any image model.

is there any news on this? the aspect ratio is still ignored from the api. since aspect ratio selection is already available in ai studio, why not in the api?

The API says it produces horizontal images, but why can’t it?