ImageGeneratorExtensions.GenerateImagesAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Generates images based on a text prompt.
public static System.Threading.Tasks.Task<Microsoft.Extensions.AI.ImageGenerationResponse> GenerateImagesAsync(this Microsoft.Extensions.AI.IImageGenerator generator, string prompt, Microsoft.Extensions.AI.ImageGenerationOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member GenerateImagesAsync : Microsoft.Extensions.AI.IImageGenerator * string * Microsoft.Extensions.AI.ImageGenerationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.ImageGenerationResponse>
<Extension()>
Public Function GenerateImagesAsync (generator As IImageGenerator, prompt As String, Optional options As ImageGenerationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ImageGenerationResponse)
Parameters
- generator
- IImageGenerator
The image generator.
- prompt
- String
The prompt to guide the image generation.
- options
- ImageGenerationOptions
The image generation options to configure the request.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The images generated by the generator.
Exceptions
generator
or prompt
is null
.