All Products
Search
Document Center

CDN:Enable and use image editing

Last Updated:Feb 22, 2024

You can enable automatic conversion to WebP, automatic rotation, and automatic compression in the Alibaba Cloud CDN console. You can also add image editing parameters to request URLs to perform more editing operations on images, such as cropping images and adding watermarks to images.

Note
  • The image editing feature of Alibaba Cloud CDN, the image editing feature of DCDN, and the Image Processing (IMG) feature of Object Storage Service (OSS) are three different features.

  • Image editing is a paid service and is free of charge until further notice.

Enable image editing

  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 navigation tree of the domain name, click Optimization.

  5. In the Image Editing section, turn on Image Editing and select the image formats that you want to convert. The following table describes the parameters.

    Note
    • After you select image formats that you want to convert, image editing is enabled. Only if you enable image editing, the image processing parameters in the URL take effect when you use object URLs to process images. Otherwise, the parameters are invalid.

    • You can enable automatic conversion to WebP, automatic rotation, and automatic compression in the Alibaba Cloud CDN console based on your business requirements.

    开通图像处理

    Parameter

    Description

    Supported Image Formats

    The image formats that you want to convert. You can select multiple formats. This parameter is required.

    Automatic Conversion to WebP

    After you turn on Automatic Conversion to WebP, if the Accept header contains image/webp, Alibaba Cloud CDN automatically converts images in other formats into the WebP format for caching.

    Note

    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 enable the automatic rotation feature, Alibaba Cloud CDN automatically rotates images.

    Note
    • Automatic rotation applies only to images that have the auto-orient parameter.

    • 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 image quality is reduced to 90% of the original quality.

    Note

    Automatic compression supports only images in the JPEG and WebP formats.

  6. Click OK.

Use object URLs to process images

  1. Enable image editing and select the image formats that you want to convert. For more information, see Enable image editing.

  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

      The object to which you can pass image editing parameters.

      action,param_value

      The action, parameter, and value of the image editing operation. Separate multiple actions with forward slashes (/). Alibaba Cloud CDN performs the actions based on the order of parameters. For more information about image editing parameters, see Image editing parameters.

    • Example: http://example.com/image_01.png?image_process=resize,w_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 into the WebP format.

Image editing parameters

You can also add image editing parameters to request URLs to perform more editing operations on images. 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 into specific formats.

Adjust image quality

quality

Adjusts 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 specific orientations.

Rotates images based on the orientation parameter or rotates images clockwise based on the angle that you specify.

Change the color of an image

  • bright: the brightness of images.

  • contrast: the contrast of images.

  • sharpen: the sharpness of images.

Adjusts the brightness, contrast, and sharpness of images.

Add watermarks

watermark

Adds picture or text watermarks to images.

Query image information

info

Queries image information, including the width, height, format, and quality.