Table of Contents

Class ImageConfig

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

Configuration for image generation in models that support image output (e.g., gemini-2.5-flash-image, gemini-3-pro-image-preview).

public class ImageConfig
Inheritance
ImageConfig
Inherited Members
Extension Methods

Remarks

Use ImageConfigValues for common predefined values.

Properties

AspectRatio

Optional. The aspect ratio for generated images.

[JsonPropertyName("aspectRatio")]
public string? AspectRatio { get; set; }

Property Value

string

Remarks

Common values include "1:1" (square), "16:9" (landscape), "9:16" (portrait), "4:3", and "3:4". See ImageConfigValues.AspectRatios for predefined constants.

ImageOutputOptions

Optional. The image output options for generated images.

[JsonPropertyName("imageOutputOptions")]
public ImageOutputOptions? ImageOutputOptions { get; set; }

Property Value

ImageOutputOptions

Remarks

Only supported on certain models like gemini-3-pro-image-preview.

ImageSize

Optional. The output resolution for generated images.

[JsonPropertyName("imageSize")]
public string? ImageSize { get; set; }

Property Value

string

Remarks

Values: "1K", "2K", "4K". Only supported on certain models like gemini-3-pro-image-preview. See ImageConfigValues.ImageSizes for predefined constants.

OutputCompressionQuality

JPEG compression quality (0-100). Vertex AI only.

[JsonPropertyName("outputCompressionQuality")]
public int? OutputCompressionQuality { get; set; }

Property Value

int?

OutputMimeType

MIME type of the generated image, for example image/jpeg. Vertex AI only.

[JsonPropertyName("outputMimeType")]
public string? OutputMimeType { get; set; }

Property Value

string

PersonGeneration

Whether people may be generated, for example ALLOW_ADULT or DONT_ALLOW. Vertex AI only.

[JsonPropertyName("personGeneration")]
public string? PersonGeneration { get; set; }

Property Value

string

ProminentPeople

Whether images of prominent people may be generated. Vertex AI only.

[JsonPropertyName("prominentPeople")]
public ProminentPeople? ProminentPeople { get; set; }

Property Value

ProminentPeople?

See Also