Share via


OpenAITextToImageService.GenerateImageAsync Method

Definition

Generate an image matching the given description

public System.Threading.Tasks.Task<string> GenerateImageAsync (string description, int width, int height, Microsoft.SemanticKernel.Kernel? kernel = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GenerateImageAsync : string * int * int * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
override this.GenerateImageAsync : string * int * int * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function GenerateImageAsync (description As String, width As Integer, height As Integer, Optional kernel As Kernel = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

description
String

Image generation prompt

width
Int32

Image width in pixels

height
Int32

Image height in pixels

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

Generated image in base64 format or image URL

Implements

Applies to