API Reference
Extract Contents

Extract Image Content

Action ExtractContents

Introduction

This interface is used to extract contents from an image and can also be used to obtain the mask of the contents.

Request

Parameter NameTypeDescriptionRequired
ActionStringThe corresponding API instruction name
PublicKeyStringUser's public key, which can be obtained from the PICPIK User Center (opens in a new tab)
SignatureStringUser's signature generated based on the public key and API instruction, see Signature for details
request_uuidStringRequest UUID, randomly generated by using the UUID generation method. This parameter can be utilized to manage the requests of your business and clients.
Parameter NameTypeDescriptionRequired
RawImageStringThe raw image encoded in Base64.
IncludePointList[]CoordinateA coordinates list indicates contents need to be extracted.
ExcludePointList[]CoordinateA coordinates list indicates contents need to be excluded.
ErodeSizeIntBlurred pixels (0~40) on the edge of the contents to be extracted, default: 15
ForegroundThresholdIntForeground threshold (0~255), default: 240
BackgroundThresholdIntBackground threshold (0~255),default: 15
HairOptimizationStringHair optimization. Available values: auto, on, off. Default: auto
OnlyMaskBoolWhether returns mask only, default: false

Intro to Complex Data Types

Coordinate

Parameter NameTypeDescriptionRequired
XIntx-axis value
YInty-axis value

Request Example

{
    "Action":"ExtractContents",
    "PublicKey":"ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
    "Signature":"2e3ded4d95337e8e0e76c05f056ff958eb98f062",
    "request_uuid":"15ba36f2-2d69-40bd-9e0c-3e73f0f5acd0",
    "IncludePointList":[
        {
            "X":72,
            "Y":270
        }
    ],
    "RawImage":"data:image/jpeg;base64,xxx"
}

Response

Field NameTypeDescriptionRequired
RetCodeIntReturn status code: 0 indicates a successful return, while non-zero indicates a failure
ActionStringInstruction name
MessageStringThe error message is returned when RetCode is non-zero, providing a detailed description
request_uuidStringReturns the UUID that was included in the request
Parameter NameTypeDescriptionRequired
TaskUIDStringTask UID, used to query task details and get results

Response Example

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