Table of Contents

TTMSMCPCloudImageAI.Execute Method

Starts creating an image from a prompt.

API unit family: TMS.MCP.CloudImageAI Declaring type: TTMSMCPCloudImageAI Inherited from: TTMSMCPCustomCloudImageAI

Overloads

Overload 1

Starts creating an image from a prompt.

procedure Execute(APrompt: string); overload;

Remarks

Returns immediately; the outcome arrives through the image or error event on the main thread. When the reference image collection is not empty its items are sent along with the prompt, so the call becomes an editing request rather than a plain text-to-image request. Raises an exception on the calling thread when no authentication key has been set.

Parameters

Name Description
APrompt Instruction describing the image to create.

Overload 2

Starts transforming a base64-encoded image according to a prompt.

procedure Execute(ABase64Image: string; APrompt: string); overload;

Remarks

Decodes the string into a temporary stream that is released before the call returns, so the caller keeps ownership of nothing extra. Returns immediately; the outcome arrives through the image or error event on the main thread. Raises an exception on the calling thread when no authentication key has been set, and also when the selected service offers no image-to-image operation.

Parameters

Name Description
ABase64Image Source image as a base64-encoded string.
APrompt Instruction describing the transformation to apply.

Overload 3

Starts transforming the image held in a stream according to a prompt.

procedure Execute(AImageStream: TStream; APrompt: string); overload;

Remarks

The stream must stay alive and unchanged until the request has been built. Returns immediately; the outcome arrives through the image or error event on the main thread. Raises an exception on the calling thread when no authentication key has been set, and also when the selected service offers no image-to-image operation.

Parameters

Name Description
AImageStream Stream holding the source image. Its position is reset to the beginning before the request is built, and the caller keeps ownership of it.
APrompt Instruction describing the transformation to apply.

Overload 4

Starts transforming the content of a bitmap according to a prompt.

procedure Execute(AImage: TBitmap; APrompt: string); overload;

Remarks

Returns immediately; the outcome arrives through the image or error event on the main thread. Raises an exception on the calling thread when no authentication key has been set, and also when the selected service offers no image-to-image operation.

Parameters

Name Description
AImage Bitmap holding the source image. Its content is copied into a temporary stream, and the bitmap itself is left unchanged.
APrompt Instruction describing the transformation to apply.

Overload 5

Starts transforming the content of a picture according to a prompt.

procedure Execute(AImage: TPicture; APrompt: string); overload;

Remarks

Returns immediately; the outcome arrives through the image or error event on the main thread. Raises an exception on the calling thread when no authentication key has been set, and also when the selected service offers no image-to-image operation.

Parameters

Name Description
AImage Picture holding the source image. Its content is copied into a temporary stream, and the picture itself is left unchanged.
APrompt Instruction describing the transformation to apply.