Multi-image Composition

Mix up to 14 reference images for complex scenes

Gemini 3 Pro Image Preview allows you to mix up to 14 reference images to create complex compositions, including object placement and character consistency.

Up to 14 Reference Images

Mix 6 object images + 5 portrait photos

4K Resolution

Generate professional assets up to 4096x4096

Mixing Reference Images

Combine multiple images to create new compositions while maintaining consistency.

Image Limits

  • Maximum 6 high-fidelity object images
  • Maximum 5 portrait photos for character consistency
Python - Mix Multiple Reference Images
from google import genai
from google.genai import types
from PIL import Image

prompt = "An office group photo of these people, they are making funny faces."
aspect_ratio = "5:4"
resolution = "2K"

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=[
        prompt,
        Image.open('person1.png'),
        Image.open('person2.png'),
        Image.open('person3.png'),
        Image.open('person4.png'),
        Image.open('person5.png'),
    ],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
            image_size=resolution
        ),
    )
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif image:= part.as_image():
        image.save("office.png")

Google Search Grounding

Use real-time information from Google Search to generate images based on current data like weather forecasts or stock charts.

Important Notes

  • Image-based search results are not passed to the model
  • Image-only mode does not return images with grounding
Python - Google Search Grounding
from google import genai
from google.genai import types

prompt = "Visualize the current weather forecast for the next 5 days in San Francisco as a clean, modern weather chart. Add a visual on what I should wear each day"
aspect_ratio = "16:9"

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['Text', 'Image'],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
        ),
        tools=[{"google_search": {}}]
    )
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif image:= part.as_image():
        image.save("weather.png")

4K Resolution Output

Generate high-resolution images up to 4K. Note: Must use uppercase K (1K, 2K, 4K).

1K
1024x1024
2K
2048x2048
4K
4096x4096
Python - 4K Resolution Output
from google import genai
from google.genai import types

prompt = "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."
aspect_ratio = "1:1"
resolution = "4K"  # Must use uppercase K

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
            image_size=resolution
        ),
    )
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif image:= part.as_image():
        image.save("butterfly_4k.png")