Converting Format

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


    CI uses the imageMogr2 API to perform format conversion, GIF optimization, and progressive display.

    API Format



    Parameter Description
    download_url URL of the input image, formatted as <bucketname-appid>.cos.<picture region="">.<domain>.com/<picture name="">
    /format/ Converts the image format. The target format can be JPG, BMP, GIF, PNG, WebP, or YJPEG (a JPEG-based format optimized by CI). Default format: format of the input image
    /cgif/&dxlt;FrameNumber&dxgt; Optimizes a GIF image by reducing the number of frames and colors. Valid values of FrameNumber:
  • 1: cuts the input GIF to the default number of frames (30). If the original number of frames is greater than 30, the exceeded frames will be cut.
  • (1,100]: compresses the image to the specified number of frames.
  • /interlace/&dxlt;Mode> Progressive mode of the output JPG image. Valid values of Mode:
    0 (default): disables the progressive mode.
    1: enables the progressive mode.
    This parameter takes effect only when the output image is in JPG format. Otherwise, this parameter will be ignored.
    /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.


    Converting a JPEG image into PNG format

    Converting a JPEG image into PNG format 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 (&):<signature>&imageMogr2/format/png

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