task_id upon success.task_id until the status is completed, and obtain the result image URL from output.file_url.mode, and output with the scale factor or target width and height.Parameter Name | Required | Type | Description |
image_url | Yes | string | Enter the image URL. http(s) public network URLs or data:image/...;base64,... format are supported. Example: https://example.com/a.png |
mode | No | string | Super-resolution mode. aspect: Super-resolution to the larger rectangle of the specified width and height; fixed: Super-resolution to a fixed width and height with forced scaling; percent (default): Super-resolution by a ratio, which can be a decimal. |
percent | No | float | Magnification factor. The value must be greater than or equal to 1.0. For example, 2.0 means 2x magnification. This parameter takes effect only when mode=percent. |
width | No | integer | Target width (pixel) |
height | No | integer | Target height (pixel) |
long_side | No | integer | Target long side (pixel). |
short_side | No | integer | Target short side (pixel). |
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"image_url": "https://example.com/a.png","mode": "percent","percent": 2.0}'
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"image_url": "https://example.com/a.png","mode": "fixed","width": 1920,"height": 1080}'
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"image_url": "https://example.com/a.png","mode": "aspect","short_side": 1440}'
Parameter Name | Type | Description |
task_id | string | Unique task identifier, used to poll the query API. |
status | string | Task status. |
request_id | string | Unique request identifier. Include it when troubleshooting issues. |
{"task_id": "1400000001-ProcessImageAsync-xxxxxxxx","status": "queued","request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9"}
status is completed or failed.GET https://tokenhub.tencentmaas.com/v1/wand/tool/image-super-resolution/tasks/{task_id}Parameter Name | Required | Type | Description |
task_id | Yes | string | Path parameter. Task ID returned by the submission API, which must be passed in as is. |
curl -X GET 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution/tasks/1400000001-ProcessImageAsync-xxxxxxxx' \\-H 'Authorization: Bearer YOUR_API_KEY'
Parameter Name | Type | Description |
task_id | string | Unique task identifier. |
status | string | Task status: queued / in_progress / completed / failed. |
progress | integer | Processing progress, ranging from 0 to 100. |
output | object | Result product, returned only when completed. |
output.file_url | string | URL of the result image, which can be directly downloaded or accessed. |
error | object | Failure details, returned only when failed. |
error.code | string | Error code. See "Unified error codes". |
error.message | string | Error description, used for troubleshooting and not recommended for program logic judgment. |
request_id | string | Unique request identifier. Include it when troubleshooting issues. |
{"task_id": "1400000001-ProcessImageAsync-xxxxxxxx","status": "completed","progress": 100,"output": {"file_url": "https://XXXXXXX.png"},"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"}
{"task_id": "1400000001-ProcessImageAsync-xxxxxxxx","status": "failed","progress": 100,"error": {"code": "InternalError","message": "internal error"},"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"}
{"request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9", "error": {"message": "...", "type": "..."}}
HTTP | type | Meaning |
400 | invalid_request_error | Parameter error: image_url is missing or has an invalid format, mode is invalid, JSON decoding failed, task_id has an invalid format, or the task does not exist. Correct the request based on message and retry. |
401 | invalid_api_key | The API Key is missing or invalid. Check the Authorization request header. |
404 | not_found | The request path does not exist. Check the path spelling. |
405 | method_not_allowed | The request method is not allowed. Use POST for submission and GET for query. |
429 | rate_limit_exceeded | QPS rate limiting has been triggered (20 QPS by default for submission and 100 QPS by default for query). Reduce the request frequency and retry. |
429 | quota_exceeded | The quota has been exhausted. Retry later or apply for a quota increase. |
500 | server_error | An internal server error has occurred. You can retry. If the issue persists, submit a ticket with the Request ID for troubleshooting. |
status: failed, and the values of error.code are as follows:Error Code | Meaning |
InvalidParameterValue | The parameter is invalid. Check the input parameters. |
InternalError | An internal server error has occurred. You can retry. If the issue persists, submit a ticket with the Request ID for troubleshooting. |
image_url is a required field. Make sure the field name is spelled image_url and the value is a non-empty string.aspect: upscale to a larger rectangle that can contain the specified width and height. fixed: force scaling to the specified width and height, which may change the aspect ratio. percent (default): upscale by a scale factor.mode:mode=percent uses percent;mode=fixed uses width / height;mode=aspect uses long_side / short_side.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários