Table of Contents

Class EditImageConfig

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

Configuration for editing an image.

public record EditImageConfig : IEquatable<EditImageConfig>
Inheritance
EditImageConfig
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

BaseSteps

The number of sampling steps. A higher value has better image quality, while a lower value has better latency.

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

Property Value

int?

EditMode

Describes the editing mode for the request.

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

Property Value

EditMode?

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

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 EditImageConfig object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

EditImageConfig

The deserialized EditImageConfig object, or null if deserialization fails.