Generate Thumbnail - Generate Thumbnail
此作業會產生具有使用者指定寬度和高度的縮圖影像。 根據預設,此服務會分析影像、識別相關區域 (ROI),並根據 ROI 產生智慧裁剪的座標。 當您指定與輸入影像不同的外觀比例時,智慧裁剪有助於。 成功的回應會包含縮圖影像二進位檔。 如果要求失敗,回應會包含錯誤碼和訊息,以協助判斷發生錯誤的原因。 失敗時,會傳回錯誤碼和錯誤訊息。 錯誤碼可以是 InvalidImageUrl、InvalidImageFormat、InvalidImageSize、InvalidThumbnailSize、NotSupportedImage、FailedToProcess、Timeout 或 InternalServerError 的其中一個。
POST {Endpoint}/vision/v3.1/generateThumbnail?width={width}&height={height}
POST {Endpoint}/vision/v3.1/generateThumbnail?width={width}&height={height}&smartCropping={smartCropping}
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
支援的認知服務端點。 |
height
|
query | True |
integer int32 |
縮圖的高度,以像素為單位。 它必須介於 1 到 1024 之間。 建議的最小值為 50。 |
width
|
query | True |
integer int32 |
縮圖的寬度,以像素為單位。 它必須介於 1 到 1024 之間。 建議的最小值為 50。 |
smart
|
query |
boolean |
用於啟用智慧裁剪的布爾值旗標。 |
要求標頭
名稱 | 必要 | 類型 | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
要求本文
名稱 | 必要 | 類型 | Description |
---|---|---|---|
url | True |
string |
影像的可公開連線 URL。 |
回應
名稱 | 類型 | Description |
---|---|---|
200 OK |
file |
產生的二進位格式縮圖。 Media Types: "application/octet-stream" |
Other Status Codes |
錯誤回應。 Media Types: "application/octet-stream" |
安全性
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
範例
Successful GenerateThumbnail request
Sample Request
POST https://westus.api.cognitive.microsoft.com/vision/v3.1/generateThumbnail?width=500&height=500&smartCropping=True
{
"url": "{url}"
}
Sample Response
"{Binary}"
定義
名稱 | Description |
---|---|
Computer |
API 要求錯誤的詳細數據。 |
Computer |
錯誤碼。 |
Image |
ComputerVisionError
API 要求錯誤的詳細數據。
名稱 | 類型 | Description |
---|---|---|
code |
錯誤碼。 |
|
message |
string |
說明服務所報告錯誤的訊息。 |
requestId |
string |
唯一的要求標識碼。 |
ComputerVisionErrorCodes
錯誤碼。
名稱 | 類型 | Description |
---|---|---|
BadArgument |
string |
|
CancelledRequest |
string |
|
DetectFaceError |
string |
|
FailedToProcess |
string |
|
InternalServerError |
string |
|
InvalidDetails |
string |
|
InvalidImageFormat |
string |
|
InvalidImageSize |
string |
|
InvalidImageUrl |
string |
|
InvalidModel |
string |
|
InvalidThumbnailSize |
string |
|
NotSupportedFeature |
string |
|
NotSupportedImage |
string |
|
NotSupportedLanguage |
string |
|
NotSupportedVisualFeature |
string |
|
StorageException |
string |
|
Timeout |
string |
|
Unspecified |
string |
|
UnsupportedMediaType |
string |
ImageUrl
名稱 | 類型 | Description |
---|---|---|
url |
string |
影像的可公開連線 URL。 |