Last updated: 2020-06-11 16:37:46

    Feature

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

    Image processing is a paid service, the fees of which are charged by Cloud Infinite. For detailed billing instructions, see Cloud Infinite’s [Billing and Pricing] (https://intl.cloud.tencent.com/document/product/1045/33431).

    API Form

    download_url?imageMogr2/thumbnail/<imageSizeAndOffsetGeometry>

    Parameter Description

    Operation name: thumbnail.

    Parameter Description
    download_url URL that is used to access a file. Format: <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 the an image is Scale% of the original image while the width keeps unchanged.
    /thumbnail/<Width>x Specifies the target image width, with the height proportionally scaled down.
    /thumbnail/x<Height> Specifies the target image height, with the width proportionally scaled down.
    /thumbnail/<Width>x<Height> Specifies the maximum width and height of a thumbnail for proportional scaling
    /thumbnail/!<Width>x<Height>r Specifies the minimum width and height of a thumbnail for proportional scaling
    /thumbnail/<Width>x<Height> Forces image scaling with the specified Width and Height, which may cause deformation of the target image
    /thumbnail/<Area>@ Proportionally scales an image so that its total pixels does not exceed the value of Area

    Examples

    Take the image below as an example:

    Example 1: scaling width and height

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

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

    Final image:

    Example 2: scaling width while keeping height unchanged

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

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

    Final image:

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help