Table of Contents

TTMSMCPCloudImageAI.ReplaceBackground Method

Starts placing the subject of one base64-encoded image onto the background of another.

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

Overloads

Overload 1

Starts placing the subject of one base64-encoded image onto the background of another.

procedure ReplaceBackground(ABase64Ref, ABase64Background: string); overload;

Remarks

Decodes both strings into temporary streams that are released before the call returns. Returns immediately; the outcome arrives through the image or error event on the main thread. Depending on the selected service this may start a job that the component polls, which makes the wait for the event noticeably longer than for other operations. Raises an exception on the calling thread when no authentication key has been set.

Parameters

Name Description
ABase64Ref Image supplying the subject, as a base64-encoded string.
ABase64Background Image supplying the new background, as a base64-encoded string.

Overload 2

Starts placing the subject of one image onto the background of another, both supplied as streams.

procedure ReplaceBackground(ARefStream, ABackgroundStream: TStream); overload;

Remarks

Both streams 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. Depending on the selected service this may start a job that the component polls. Raises an exception on the calling thread when no authentication key has been set.

Parameters

Name Description
ARefStream Stream holding the image that supplies the subject. Its position is reset to the beginning before the request is built, and the caller keeps ownership of it.
ABackgroundStream Stream holding the image that supplies the new background. Its position is reset to the beginning before the request is built, and the caller keeps ownership of it.

Overload 3

Starts placing the subject of one bitmap onto the background of another.

procedure ReplaceBackground(ARefImage, ABackgroundImage: TBitmap); overload;

Remarks

Returns immediately; the outcome arrives through the image or error event on the main thread. Depending on the selected service this may start a job that the component polls. Raises an exception on the calling thread when no authentication key has been set.

Parameters

Name Description
ARefImage Bitmap supplying the subject. Its content is copied into a temporary stream and the bitmap itself is left unchanged.
ABackgroundImage Bitmap supplying the new background. Its content is copied into a temporary stream and the bitmap itself is left unchanged.

Overload 4

Starts placing the subject of one picture onto the background of another.

procedure ReplaceBackground(ARefImage, ABackgroundImage: TPicture); overload;

Remarks

Returns immediately; the outcome arrives through the image or error event on the main thread. Depending on the selected service this may start a job that the component polls. Raises an exception on the calling thread when no authentication key has been set.

Parameters

Name Description
ARefImage Picture supplying the subject. Its content is copied into a temporary stream and the picture itself is left unchanged.
ABackgroundImage Picture supplying the new background. Its content is copied into a temporary stream and the picture itself is left unchanged.