After you enable image editing, Alibaba Cloud CDN can resize, crop, or rotate the images that are distributed by the service. Image editing reduces the number of back-to-origin requests and accelerates content delivery. This topic describes how to enable and configure image editing.

Note Image editing is a paid service. It is currently free of charge until further notice.

Features

Enable image editing in the Alibaba Cloud CDN console

You can enable automatic conversion to WebP, automatic rotation, and automatic compression in the Alibaba Cloud CDN console.

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
  4. In the left-side management pane of the domain name, click Optimization.
  5. In the Image Editing section, turn on Image Editing and configure the parameters as prompted. The following table describes the parameters.
    Enable image editing
    Parameter Description
    Supported Image Formats The image formats that you want to convert. You can select multiple formats.
    Note The following image formats are supported: JPEG, PNG, WebP, BMP, GIF, TIFF, and JPEG 2000.
    Automatic Conversion to WebP After you turn on Automatic Conversion to WebP, images in other formats are automatically converted to the WebP format,
    Notice After you turn on Automatic Conversion to WebP, the cache hit ratio decreases within a short period of time and is gradually restored after images are converted. Do not enable this feature during peak hours.
    Automatic Rotation After you turn on Automatic Rotation, images are automatically rotated to a proper orientation.
    Note
    • Automatic rotation applies only to images that have orientation properties.
    • After you turn on Automatic Rotation, the cache hit ratio decreases within a short period of time and is gradually restored after images are rotated. Do not enable this feature during peak hours.
    Automatic Compression Automatic compression reduces the file size of images without the need to change the resolution, size, and format of the images. This reduces data transfer. Default value: 0. Valid values:
    • 0: Auto compression is disabled.
    • 1 to 100: Auto compression is enabled. For example, if you enter 90% in the Automatic Compression field, the quality of the image is changed to 90% of the original quality.
    Note Automatic compression supports only images in the JPEG and WebP formats.
  6. Click OK.

Customize image editing

You can add parameters to request URLs to customize image editing.

  1. Enable image editing. For more information, see Enable image editing in the console.
    Note Check whether you need to enable the automatic conversion to WebP, automatic rotation, and automatic compression features based on your business requirements.
  2. Add parameters to request URLs to customize image editing.
    • Format: http://example.com/image_01.png?image_process=action,param_value/action*,param_value*
      Field Description
      example.com The accelerated domain name.
      image_01.png The name of the image.
      image_process=action
      • image_process specifies the object to which you can pass image editing parameters.
      • action specifies the image editing parameter that you want to pass to image_process. For more information, see Image editing parameters.
      param_value The value of the image editing parameter.

      For example, image_process=rotate,90 specifies that images are rotated 90 degrees clockwise. param_value is 90.

      action*,param_value* You can add multiple parameters. Separate the parameters with forward slashes (/).
      Note The image editing parameters in URLs take effect only if image editing is enabled. Otherwise, the parameters are invalid.
    • Example: http://example.com/image_01.png?image_process=resize,l_200/rotate,90/format,webp
    • Expected result: The width of the image is changed to 200 pixels, and the height of the image is adjusted based on the original width-height ratio. Then, the image is rotated 90 degrees clockwise and converted to the WebP format.

Image editing parameters

Alibaba Cloud CDN allows you to add one or more image editing parameters to a request URL. The following table describes the image editing parameters.
Feature Parameter Description
Convert image formats format Converts images to specified formats.
Adjust image quality quality Changes the quality of images.
Crop images crop Crops images.
Resize images resize Resizes images.
Rotate images
  • auto-orient: automatically rotates images.
  • rotate: rotates images to specified orientations.
Rotates images based on the orientation properties or rotates images clockwise based on the angle that you specify.
Change the color of an image
  • bright: specifies the brightness of images.
  • contrast: specifies the contrast of images.
  • sharpen: specifies the sharpness of images.
Adjusts the brightness, contrast, and sharpness of images.
Manage image watermarks watermark Adds picture or text watermarks to images.
Query image information info Queries image information, including the size, width, height, format, and quality of the image.