Skip to content

Nano banana 2 (gemini-3.1-flash-image-preview) cannot generate 0.5K images. #4891

@Ricardo1980

Description

@Ricardo1980

I'm using genkit js and the plugin @genkit-ai/google-genai

I tried generating a 0.5K image, but it is totally impossible. It always returns a 1K image.

The documentation is not very clear about the parameter we have to send to create a 512px image:

https://ai.google.dev/gemini-api/docs/image-generation

Gemini 3 image models generate 1K images by default but can also output 2K, 4K, and 512px (05.K) (Gemini 3.1 Flash Image only) images. To generate higher resolution assets, specify the image_size in the generation_config.

You must use an uppercase 'K' (e.g. 512px (05.K), 1K, 2K, 4K). Lowercase parameters (e.g., 1k) will be rejected.

I tried "512px", "0.5K", and "05.K", but nothing, it always returns a 1024 image.

I used curl and all those possible values. None of the worked. So, I assume the problem is in the model itself. (or google apis)

Do you see the same issue?

curl -s -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
  -H "x-goog-api-key: XXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "parts": [
        {"text": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"}
      ]
    }],
    "generationConfig": {
      "responseModalities": ["IMAGE"],
      "imageConfig": {
        "imageSize": "0.5K",
        "aspectRatio": "1:1"
      }
    }
  }' | python3 -c "
import sys, json, base64
data = json.load(sys.stdin)
for part in data['candidates'][0]['content']['parts']:
    if 'inlineData' in part:
        img = base64.b64decode(part['inlineData']['data'])
        with open('/tmp/test.png', 'wb') as f:
            f.write(img)
        print(f'Saved to /tmp/test.png ({len(img)} bytes)')
        break
"

EDIT: I just saw this:
https://discuss.ai.google.dev/t/imagesize-512px-not-applied-in-gemini-3-1-flash-image-preview-always-returns-1k-resolution/127332

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions