Scaling

Last updated: 2020-05-21 17:34:10

Feature Overview

This API is used to scale images in Tencent Cloud CI.

API Form

download_url?imageMogr2/thumbnail/<imageSizeAndOffsetGeometry>

Parameter Description

Operation name: thumbnail.

Parameter Description
download_url URL that is used to access a file. The URL form is <BucketName-APPID>.cos.<picture region>.<domain>.com/<picture name>,
for example, examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpeg.
/thumbnail/!<Scale>p Specifies that the width and height of an image is Scale% of the original image.
/thumbnail/!<Scale>px Specifies that the width of an image is Scale% of the original image while the height keeps unchanged.
/thumbnail/!x<Scale>p Specifies that the height of an image is Scale% of the original image while the width keeps unchanged.
/thumbnail/<Width>x Specifies that the width of the target image is Width and the height is proportionally compressed.
/thumbnail/x<Height> Specifies that the height of the target image is Height and the width is proportionally compressed.
/thumbnail/<Width>x<Height> Limits the maximum width and height of a thumbnail to Width and Height respectively and performs proportional scaling.
/thumbnail/!<Width>x<Height>r Limits the minimum width and height of a thumbnail to Width and Height respectively and performs proportional scaling.
/thumbnail/<Width>x<Height> Ignores the width and height ratio of the original image, specifies the image width to Width and height to Height, and performs forcibly scaling, which may cause deformation of the target image.
/thumbnail/<Area>@ Proportionally scales an image so that the total pixels of the scaled image do not exceed Area.

Example

The original image is as follows:

Scaling width and height

This example shows you how to scale an image to 50% of the original image’s width and height.

http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?imageMogr2/thumbnail/!50p

The final effect is as follows:

Scaling width while keeping height unchanged

This example shows you how to scale an image to 50% of the original image’s width while keeping the height unchanged.

http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?imageMogr2/thumbnail/!50px

The final effect is as follows: