Gemini 3 Pro Image API completely ignores imageSize: '2K' parameter (Node.js SDK)

Issue: imageSize parameter ignored for image-to-image workflows

I’m experiencing an issue where the Gemini 3 Pro Image API (gemini-3-pro-image-preview) ignores the imageSize: '2K' parameter when performing image editing or upscaling with reference images, despite the configuration being correct according to the official documentation.

Expected Behavior

When using imageConfig.imageSize: '2K' with reference images, the output should be 2048×2048 pixels (for 1:1 aspect ratio).

Actual Behavior

The API returns 1024×1024 pixel images, completely ignoring the imageSize parameter.

Configuration Used

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

// Reference image upscaling workflow
const contents = [
  {
    inlineData: {
      mimeType: "image/jpeg",
      data: base64SourceImage  // 1K source image
    }
  },
  {
    inlineData: {
      mimeType: "image/png",
      data: base64CanvasTemplate  // 2K transparent canvas (2048×2048)
    }
  },
  {
    text: "Redraw the content from image 1 at the resolution of image 2 (2K)."
  }
];

const response = await ai.models.generateContent({
  model: 'gemini-3-pro-image-preview',
  contents: contents,
  config: {
    responseModalities: ['TEXT', 'IMAGE'],
    imageConfig: {
      aspectRatio: '1:1',
      imageSize: '2K'  // ← This is being IGNORED
    }
  }
});

// Result: Image dimensions are 1024×1024 instead of 2048×2048

Debug Information

Request Configuration (verified via console.log):

{
  "responseModalities": ["TEXT", "IMAGE"],
  "imageConfig": {
    "aspectRatio": "1:1",
    "imageSize": "2K"
  }
}

Contents Array:

  • Length: 3 (2 images + 1 text prompt)
  • Structure: Flat array format (not nested in parts)
  • Format: Correct according to official documentation

Response:

  • Image dimensions: 1024×1024
  • Expected: 2048×2048
  • Format: JPEG
  • No error messages or warnings

Tested Scenarios

:cross_mark: DOESN’T WORK: Text-to-image generation with imageSize: '2K'

// Simple test: text-only generation
const response = await ai.models.generateContent({
  model: 'gemini-3-pro-image-preview',
  contents: "A simple red square on white background",
  config: {
    responseModalities: ['TEXT', 'IMAGE'],
    imageConfig: {
      aspectRatio: '1:1',
      imageSize: '2K'  // ← IGNORED - Returns 1408×768 instead of 2048×2048
    }
  }
});

:cross_mark: DOESN’T WORK: Image-to-image (reference-based upscaling/editing) with imageSize: '2K'

// This ignores imageSize and returns 1K images
const response = await ai.models.generateContent({
  model: 'gemini-3-pro-image-preview',
  contents: [
    { inlineData: { mimeType: "image/jpeg", data: sourceImage } },
    { text: "Upscale this image to 2K" }
  ],
  config: {
    responseModalities: ['TEXT', 'IMAGE'],
    imageConfig: {
      aspectRatio: '1:1',
      imageSize: '2K'  // ← IGNORED when reference images are present
    }
  }
});

Environment Details

  • SDK: @google/genai (latest version, Nov 2025)
  • Model: gemini-3-pro-image-preview
  • Platform: Node.js
  • Use Case: Product image upscaling (1K → 2K)

Questions

  1. Is the imageSize parameter functional at all? Our tests show it’s completely ignored for both text-to-image AND image-to-image workflows in the Node.js SDK.

  2. Does it work in Python or other SDKs? Is this specific to @google/genai?

  3. Is this specific to the -preview model? Would the production model support this parameter?

  4. How do we actually generate 2K images? The documentation advertises 2K/4K generation but provides no working method to achieve it.

What I’ve Already Tried

  • :white_check_mark: Verified uppercase ‘K’ in imageSize: '2K' (not lowercase)
  • :white_check_mark: Tried both flat array and multi-turn conversation formats
  • :white_check_mark: Used responseModalities: ['TEXT', 'IMAGE'] (not just ['IMAGE'])
  • :white_check_mark: Verified config structure matches official documentation examples
  • :white_check_mark: Tested with different aspect ratios (1:1, 4:3, 16:9) - same issue
  • :white_check_mark: Added explicit “2K resolution” instructions in the text prompt - still ignored
  • :white_check_mark: Checked response for errors/warnings - none found

Expected Documentation Reference

The official documentation at https://ai.google.dev/gemini-api/docs/image-generation shows examples of:

  • Text-to-image generation with imageSize: '2K' :white_check_mark:
  • Multi-image composition with up to 14 reference images :white_check_mark:
  • BUT: No example combining reference images + imageSize parameter :red_question_mark:

Impact

This limitation prevents using Gemini 3 Pro Image for high-quality product image upscaling workflows, which is a significant use case for e-commerce applications.

Request

Can anyone confirm if this is expected behavior or a bug? If it’s a limitation, is there a recommended approach for achieving 2K output when working with reference images?

Thank you for any insights or workarounds!

2 Likes

Are you sure you are on the latest version? I had the same issue.

I had to update the library to the latest version. I’m using a npm package, so latest version was “@google/genai”: “^1.32.0” at the time of writing

i am still facing this issue at 1.34 version too. any solution for this?

Yeah, I have found a workaround by using the Typescript code directly copied from the Playground instead of JavaScript.