Quality Change

Last updated: 2021-07-20 16:41:19


    CI uses the imageMogr2 API to adjust the quality of an image.


    This API applies only to images in JPG and WebP formats.

    API Format



    Operation: quality

    Parameter Description
    download_url URL of the input image, formatted as <bucketname-appid>.cos.<picture region="">.<domain>.com/<picture name="">
    Example: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpeg
    /quality/&dxlt;Quality> Absolute quality of the image. Value range: 0−100. Default value: quality of the input image. The smaller value between the input image quality and the specified quality is used. If there is an exclamation mark (!) after &amp;dxlt;Quality&amp;dxgt; (for example, 90!), the specified quality is used.
    /rquality/&dxlt;quality> Relative quality of the image, relative to that of the input image. Value range: 0−100. For example, if the input image quality is 80 and rquality is set to 80, the quality of the output image is 64 (that is, 80 x 80%).
    /lquality/&dxlt;quality> The lowest quality of the output image. Value range: 0−100.
  • If the input image quality is 85 and lquality is set to 80, the quality of the output image is 85.
  • If the input image quality is 60 and lquality is set to 80, the quality of the output image will be improved to 80.
  • /ignore-error/1 If this parameter is carried and the image failed to be processed because it is too large, the input image will be returned with no error reported.


    This example sets the absolute quality to 60:


    Output image:

    This example sets the relative quality to 60:


    Output image:

    Setting the relative quality to 60 with a signature carried

    This example processes the image in the same way as in the example above except that a signature is carried. The signature is joined with other processing parameters using an ampersand (&):


    You can obtain the value of <signature> by referring to Request Signature.