API Reference
Remove Background

Remove Background

API RemoveBackground

Introduction

This interface is used to remove the background

Request

Parameter NameTypeDescriptionRequired
ActionstringThe corresponding API command name, the current API is RemoveBackground
PublicKeystringUser's public key, can be obtained from User Center (opens in a new tab)
SignaturestringUser signature generated based on public key and API command, see Signature
request_uuidstringRequest UUID, randomly generated using UUID generation method
RawImagestringBase64 of pictures that need to remove the background
Box[]intFor the boundary of the image entity, 4 numbers need to be passed,which are the x of the top left corner,y of the top left corner,x of the bottom right corner,y of the bottom right corner
RemoveTypestringRemove background type, reference value: General, Anime, default: General
ErodeSizeintSubject edge pixel blur area (0~40), default: 15
ForegroundThresholdintForeground threshold (0~255), default: 240
BackgroundThresholdintBackground threshold (0~255),default: 15
HairOptimizationstringImage Hair Optimization, reference value: auto、on、off,default: auto
OnlyMaskboolonly return masked images? default: false

Request Example

{
	"Action": "RemoveBackground",
	"PublicKey": "ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
	"Signature": "2e3ded4d95337e8e0e76c05f056ff958eb98f062",
	"request_uuid": "15ba36f2-2d69-40bd-9e0c-3e73f0f5acd0",
	"Box": [
		180,
		264,
		510,
		642
	],
	"ErodeSize": 15,
	"ForegroundThreshold": 240,
	"BackgroundThreshold": 15,
	"HairOptimization": "auto",
	"OnlyMask": false,
	"RawImage": "data:image/jpeg;base64,xxx"
}

Response

Parameter NameTypeDescriptionRequired
RetCodeintReturn status code, 0 for successful return, non-zero for failure
ActionstringOperation command name
MessagestringReturn error message, provide detailed description when RetCode is non-zero
request_uuidstringReturns the requested uuid
TaskUIDstringTask UID, used to query task details and get results

Response Example

{
	"Action": "RemoveBackground",
	"RetCode": 0,
	"Message": "",
	"request_uuid": "8482d350-04f9-421b-817b-1d98b3a4dcfa",
	"TaskUID": "cktlm6lrh4xxx8ng9nf0"
}