图片删除背景
智能检测图像中的前景主体并实现精细化背景分割抠图

接口地址: https://myapi.2su.cc/api/image-remove-background-pixian

返回格式: JSON

请求方式: POST

请求示例: https://myapi.2su.cc/api/image-remove-background-pixian?apiKey=用户中心apiKey

请求参数说明:

名称 必填 类型 说明
image string 图片:根据行为填写对应的值
act string 请求行为:image二进制文件 | base64进行base64编码的图片 | url图片链接
image file 图片文件

返回参数说明:

名称 类型 说明
code int 状态码
msg string 信息
data string 图片链接

返回示例:

{
    "code": 200,
    "msg": "成功",
    "data": "https://myapi.2su.cc/image/myapi_2su_cc_127.0.0.1_1687531300744.png"
}

请求参数设置:

参数名称 参数值


{
    "code": 200,
    "msg": "成功",
    "data": "https://myapi.2su.cc/image/myapi_2su_cc_127.0.0.1_1687531300744.png"
}

错误码格式说明:

名称 类型 说明
code int 错误码

代码示例:

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://myapi.2su.cc/api/image-remove-background-pixian',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array( 'apiKey' => '用户中心apiKey', 'act' => 'url', 'image' => 'https://myapi.2su.cc/image/test.jpg' ),
CURLOPT_HTTPHEADER => array(
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;