Task: Remove Watermark
Short description: Use the watermark removal API to remove specified watermark areas from images.
Overview
- Method:
POST - Path:
/task/pic/watermark - Content-Type:
multipart/form-data
Authentication
- Header:
Authorization: Bearer <token>
Request Example
Form Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| image_file | file | No | Source image file (binary), mutually exclusive with image_url |
| image_url | string | No | Source image URL, mutually exclusive with image_file |
| mask_file | file | No | Mask file (binary), mutually exclusive with mask_url and rectangles; white areas indicate removal regions |
| mask_url | string | No | Mask image URL, mutually exclusive with mask_file and rectangles |
| rectangles | string | No | JSON string list of rectangle areas, up to 50 regions, e.g. [{"x":0,"y":0,"width":100,"height":100}] |
| sync | integer | No | Whether to wait for the result: 0=async (default), 1=sync |
| callback_url | string | No | Callback URL for notifications |
curl Example
bash
curl -X POST "https://api.gpt.ge/task/pic/watermark" \
-H "Authorization: Bearer sk-xxxx" \
-F "image_url=https://example.com/image.png" \
-F "rectangles=[{\"x\":0,\"y\":0,\"width\":100,\"height\":100}]" \
-F "sync=1"JavaScript (fetch) Example
javascript
const formData = new FormData();
formData.append('image_url', 'https://example.com/image.png');
formData.append('rectangles', '[{"x":0,"y":0,"width":100,"height":100}]');
formData.append('sync', '1');
fetch('https://api.gpt.ge/task/pic/watermark', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-xxxx'
},
body: formData
}).then(r => r.json()).then(console.log);Python (requests) Example
python
import requests
url = 'https://api.gpt.ge/task/pic/watermark'
headers = {
'Authorization': 'Bearer sk-xxxx'
}
files = {
'image_url': (None, 'https://example.com/image.png')
}
data = {
'rectangles': '[{"x":0,"y":0,"width":100,"height":100}]',
'sync': '1'
}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())Response Example (200)
json
{
"status": 200,
"data": {
"completed_at": 1742670627,
"created_at": 1742670626,
"download_time": 488,
"err_info": "",
"foreground_rect": {
"x": 133,
"y": 110,
"width": 604,
"height": 952
},
"image": "https://wxtechsz.oss-cn-shenzhen.aliyuncs.com/tasks/output/segmentation/3b950563-e53f-4036-a581-5ac04d0829b3-image.png",
"image_height": 1152,
"image_width": 864,
"output_type": 2,
"processed_at": 1742670626,
"progress": 100,
"result_type": "object",
"return_type": 1,
"state": 1,
"state_detail": "Complete",
"task_id": "3b950563-e53f-4036-a581-5ac04d0829b3",
"time_elapsed": 384.54998779296875,
"type": "auto"
}
}Note: This endpoint uses
multipart/form-datato upload the image. Use one ofmask_file,mask_url, orrectangles, not multiple. Therectanglesfield must be a JSON string.