Table of Contents

Class Image

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

An image.

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

Properties

GcsUri

The Cloud Storage URI of the image. Image can contain a value for this field or the image_bytes field but not both.

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

Property Value

string

ImageBytes

The image bytes data. Image can contain a value for this field or the gcs_uri field but not both.

[JsonPropertyName("imageBytes")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public byte[]? ImageBytes { get; set; }

Property Value

byte[]

MimeType

The MIME type of the image.

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

Property Value

string

Methods

FromFile(string, string?)

public static Image FromFile(string location, string? mimeType = null)

Parameters

location string
mimeType string

Returns

Image

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a Image object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

Image

The deserialized Image object, or null if deserialization fails.