Task: Image Enhancement (Lossless Upscale)
Short description: Use the image enhance API to enlarge and improve image clarity without quality loss.
Overview
- Method:
POST - Path:
/task/pic/scale - 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 |
| sync | integer | No | Whether to wait for the result: 0=async (default), 1=sync |
| type | string | No | Enhancement type: clean=general enhancement, face=portrait enhancement (up to 10 faces per image) |
| scale_factor | integer | No | Scale factor: blank=auto, 1=no scaling, 2=2x, 4=4x |
| callback_url | string | No | Callback URL for notifications |
curl Example
bash
curl -X POST "https://api.gpt.ge/task/pic/scale" \
-H "Authorization: Bearer sk-xxxx" \
-F "image_url=https://example.com/image.jpg" \
-F "sync=1" \
-F "type=clean" \
-F "scale_factor=4"JavaScript (fetch) Example
javascript
const formData = new FormData();
formData.append('image_url', 'https://example.com/image.jpg');
formData.append('sync', '1');
formData.append('type', 'clean');
formData.append('scale_factor', '4');
fetch('https://api.gpt.ge/task/pic/scale', {
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/scale'
headers = {
'Authorization': 'Bearer sk-xxxx'
}
files = {
'image_url': (None, 'https://example.com/image.jpg')
}
data = {
'sync': '1',
'type': 'clean',
'scale_factor': '4'
}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())Response Example (200)
json
{
"status": 200,
"data": {
"completed_at": 1742687863,
"created_at": 1742687863,
"download_time": 0,
"image": "https://wxtechsz.oss-cn-shenzhen.aliyuncs.com/tasks/output/scale/7df94a60-1b62-40d6-a0f5-abf35bafce75.jpg",
"image_height": 1152,
"image_width": 864,
"processed_at": 1742687862,
"progress": 100,
"return_type": 1,
"state": 1,
"state_detail": "Complete",
"task_id": "7df94a60-1b62-40d6-a0f5-abf35bafce75",
"time_elapsed": 356.4800109863281,
"type": "clean"
}
}Note: This endpoint uses
multipart/form-datato upload the image. Submit eitherimage_urlorimage_file, not both.