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.1/generateThumbnail?width={width}&height={height}
POST {Endpoint}/vision/v3.1/generateThumbnail?width={width}&height={height}&smartCropping={smartCropping}

URI Parameters

Name In Required Type Description
Endpoint
path True

string

Supported Cognitive Services endpoints.

height
query True

integer

int32

Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50.

width
query True

integer

int32

Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50.

smartCropping
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

ComputerVisionError

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.1/generateThumbnail?width=500&height=500&smartCropping=True


{
  "url": "{url}"
}

Sample Response

"{Binary}"

Definitions

Name Description
ComputerVisionError

Details about the API request error.

ComputerVisionErrorCodes

The error code.

ImageUrl

ComputerVisionError

Details about the API request error.

Name Type Description
code

ComputerVisionErrorCodes

The error code.

message

string

A message explaining the error reported by the service.

requestId

string

A unique request identifier.

ComputerVisionErrorCodes

The error code.

Name Type 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

Name Type Description
url

string

Publicly reachable URL of an image.