Skip to content

任务:去水印-自动

简洁描述:使用自动去水印接口对图像中的水印进行智能移除,并返回去水印后的结果文件。


概览

  • 请求方法:POST
  • 路径:/task/pic/watermark_auto
  • 内容类型:multipart/form-data

认证方式

  • Header:Authorization: Bearer <token>

请求示例

表单参数

参数类型必填说明
filefile源图像文件(二进制),与 url 二选一
urlstring源图像 URL,与 file 二选一
syncinteger是否等待结果就绪:0=异步(默认),1=同步
callback_urlstring回调通知地址

curl 示例

bash
curl -X POST "https://api.gpt.ge/task/pic/watermark_auto" \
  -H "Authorization: Bearer sk-xxxx" \
  -F "url=https://example.com/image-with-watermark.png" \
  -F "sync=1"

JavaScript (fetch) 示例

javascript
const formData = new FormData();
formData.append('url', 'https://example.com/image-with-watermark.png');
formData.append('sync', '1');

fetch('https://api.gpt.ge/task/pic/watermark_auto', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-xxxx'
  },
  body: formData
}).then(r => r.json()).then(console.log);

Python(requests)示例

python
import requests

url = 'https://api.gpt.ge/task/pic/watermark_auto'
headers = {
    'Authorization': 'Bearer sk-xxxx'
}

files = {
    'url': (None, 'https://example.com/image-with-watermark.png')
}
data = {
    'sync': '1'
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())

返回示例(200)

json
{
  "status": 200,
  "data": {
    "completed_at": 1746948962,
    "created_at": 1746948961,
    "file": "https://wxtechsz.oss-cn-shenzhen.aliyuncs.com/tasks/output/visual_external_watermark_remove/2db16fc5-4fbb-43b7-b6bb-ab0c3340a5e6.jpg",
    "processed_at": 1746948961,
    "progress": 100,
    "state": 1,
    "state_detail": "Complete",
    "task_id": "2db16fc5-4fbb-43b7-b6bb-ab0c3340a5e6"
  }
}

注意:该接口使用 multipart/form-data 上传图像,建议仅使用 fileurl 中的一种方式提交源图像。