SmartPictureBoxAdapter
Namespace: Wisej.AI.Adapters
Assembly: Wisej.AI
Represents an adapter for a PictureBox that generates images based on a description using the OpenAI DALL-E endpoint.
- C#
- VB.NET
public class SmartPictureBoxAdapter : SmartAdapter
Public Class SmartPictureBoxAdapter
Inherits SmartAdapter
This adapter extends the functionality of a PictureBox by allowing it to generate images from text descriptions. It works with the OpenAI DALL-E endpoint and supports different image formats and sizes.
Constructors
SmartPictureBoxAdapter()
Initializes a new instance of SmartPictureBoxAdapter.
Properties
ImageFormat
String: Gets or sets the format in which the generated images are returned. Must be one of "url" or "b64_json". (Default: "url")
ImageSize
String: Gets or sets the size of the generated images. Must be one of "256x256", "512x512", or "1024x1024". Smaller images are faster. (Default: "1024x1024")
For DALL-E-2, image sizes must be one of "256x256", "512x512", or "1024x1024". When using DALL-E-3, images can have a size of 1024x1024, 1024x1792, or 1792x1024 pixels.
Methods
OnControlCreated(control)
Handles the event when the control is created.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control that was created. |
OnControlDisposed(control)
Handles the event when the control is disposed.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control that was disposed. |
RunAsyncCore(control)
Asynchronously runs the core logic for generating an image based on the control's text.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control containing the text description. |
Returns: Task<Message>. A task representing the asynchronous operation, with a Message result containing the generated image or image URL.
Throws:
- ArgumentNullException Thrown when the control is null.
Implements
| Name | Description |
|---|---|
| IToolProvider | Represents a provider that supplies tools. |