Generate Thumbnail - Generate Thumbnail
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.
POST {Endpoint}/vision/v3.2/generateThumbnail?width={width}&height={height}
POST {Endpoint}/vision/v3.2/generateThumbnail?width={width}&height={height}&smartCropping={smartCropping}&model-version={model-version}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
Supported Cognitive Services endpoints. |
height
|
query | True |
integer (int32) minimum: 1maximum: 1024 |
Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. |
width
|
query | True |
integer (int32) minimum: 1maximum: 1024 |
Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. |
model-version
|
query |
string pattern: ^(latest|\d{4}-\d{2}-\d{2})(-preview)?$ |
Optional parameter to specify the version of the AI model. Accepted values are: "latest", "2021-04-01", "2021-05-01". Defaults to "latest". |
|
smart
|
query |
boolean |
Boolean flag for enabling smart cropping. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
Request Body
Name | Required | Type | Description |
---|---|---|---|
url | True |
string |
Publicly reachable URL of an image. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
file |
The generated thumbnail in binary format. Media Types: "application/octet-stream" |
Other Status Codes |
Error response. Media Types: "application/octet-stream" |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Examples
Successful GenerateThumbnail request
Sample request
POST https://westus.api.cognitive.microsoft.com/vision/v3.2/generateThumbnail?width=500&height=500&smartCropping=True
{
"url": "{url}"
}
Sample response
"{Binary}"
Definitions
Name | Description |
---|---|
Computer |
The API request error. |
Computer |
The error code. |
Computer |
The API error response. |
Computer |
Details about the API request error. |
Computer |
The error code. |
Image |
ComputerVisionError
The API request error.
Name | Type | Description |
---|---|---|
code |
The error code. |
|
innererror |
Inner error contains more specific information. |
|
message |
string |
A message explaining the error reported by the service. |
ComputerVisionErrorCodes
The error code.
Value | Description |
---|---|
InternalServerError | |
InvalidArgument | |
InvalidRequest | |
ServiceUnavailable |
ComputerVisionErrorResponse
The API error response.
Name | Type | Description |
---|---|---|
error |
Error contents. |
ComputerVisionInnerError
Details about the API request error.
Name | Type | Description |
---|---|---|
code |
The error code. |
|
message |
string |
Error message. |
ComputerVisionInnerErrorCodeValue
The error code.
Value | Description |
---|---|
BadArgument | |
CancelledRequest | |
DetectFaceError | |
FailedToProcess | |
InternalServerError | |
InvalidDetails | |
InvalidImageFormat | |
InvalidImageSize | |
InvalidImageUrl | |
InvalidModel | |
InvalidThumbnailSize | |
NotSupportedFeature | |
NotSupportedImage | |
NotSupportedLanguage | |
NotSupportedVisualFeature | |
StorageException | |
Timeout | |
Unspecified | |
UnsupportedMediaType |
ImageUrl
Name | Type | Description |
---|---|---|
url |
string |
Publicly reachable URL of an image. |