Table of Contents

Class GenerateImagesConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

The config for generating an images.

public record GenerateImagesConfig : IEquatable<GenerateImagesConfig>
Inheritance
GenerateImagesConfig
Implements
Inherited Members

Properties

AddWatermark

Whether to add a watermark to the generated images.

[JsonPropertyName("addWatermark")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? AddWatermark { get; set; }

Property Value

bool?

AspectRatio

Aspect ratio of the generated images. Supported values are "1:1", "3:4", "4:3", "9:16", and "16:9".

[JsonPropertyName("aspectRatio")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? AspectRatio { get; set; }

Property Value

string

EnhancePrompt

Whether to use the prompt rewriting logic.

[JsonPropertyName("enhancePrompt")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? EnhancePrompt { get; set; }

Property Value

bool?

GuidanceScale

Controls how much the model adheres to the text prompt. Large values increase output and prompt alignment, but may compromise image quality.

[JsonPropertyName("guidanceScale")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? GuidanceScale { get; set; }

Property Value

double?

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

ImageSize

The size of the largest dimension of the generated image. Supported sizes are 1K and 2K (not supported for Imagen 3 models).

[JsonPropertyName("imageSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ImageSize { get; set; }

Property Value

string

IncludeRaiReason

Whether to include the Responsible AI filter reason if the image is filtered out of the response.

[JsonPropertyName("includeRaiReason")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? IncludeRaiReason { get; set; }

Property Value

bool?

IncludeSafetyAttributes

Whether to report the safety scores of each generated image and the positive prompt in the response.

[JsonPropertyName("includeSafetyAttributes")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? IncludeSafetyAttributes { get; set; }

Property Value

bool?

Labels

User specified labels to track billing usage.

[JsonPropertyName("labels")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string>? Labels { get; set; }

Property Value

Dictionary<string, string>

Language

Language of the text in the prompt.

[JsonPropertyName("language")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ImagePromptLanguage? Language { get; set; }

Property Value

ImagePromptLanguage?

NegativePrompt

Description of what to discourage in the generated images.

[JsonPropertyName("negativePrompt")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? NegativePrompt { get; set; }

Property Value

string

NumberOfImages

Number of images to generate.

[JsonPropertyName("numberOfImages")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? NumberOfImages { get; set; }

Property Value

int?

OutputCompressionQuality

Compression quality of the generated image (for image/jpeg only).

[JsonPropertyName("outputCompressionQuality")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? OutputCompressionQuality { get; set; }

Property Value

int?

OutputGcsUri

Cloud Storage URI used to store the generated images.

[JsonPropertyName("outputGcsUri")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? OutputGcsUri { get; set; }

Property Value

string

OutputMimeType

MIME type of the generated image.

[JsonPropertyName("outputMimeType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? OutputMimeType { get; set; }

Property Value

string

PersonGeneration

Allows generation of people by the model.

[JsonPropertyName("personGeneration")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PersonGeneration? PersonGeneration { get; set; }

Property Value

PersonGeneration?

SafetyFilterLevel

Filter level for safety filtering.

[JsonPropertyName("safetyFilterLevel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SafetyFilterLevel? SafetyFilterLevel { get; set; }

Property Value

SafetyFilterLevel?

Seed

Random seed for image generation. This is not available when add_watermark is set to true.

[JsonPropertyName("seed")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Seed { get; set; }

Property Value

int?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a GenerateImagesConfig object.

public static GenerateImagesConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

GenerateImagesConfig

The deserialized GenerateImagesConfig object, or null if deserialization fails.