Dynamic Route for CDN (DCDN) can automatically convert images to WebP format. You can also convert the format of images that are cached on DCDN nodes by using conversion parameters. This topic describes how to convert images to different formats.

Note
  • Before you use image editing, you must submit a ticket to activate this feature.
  • Image editing is a paid service. It is currently free of charge until further notice.

Automatically convert images to WebP format

WebP supports both lossy compression and lossless compression. DCDN can automatically convert images to WebP format. After you enable automatic conversion to WebP, DCDN determines whether to perform this operation based on the Accept header in requests. If image/webp is included in the Accept header, images are converted to WebP format.
Notice After you enable automatic conversion to WebP, the cache hit ratio immediately decreases and is gradually restored after images are converted. Do not enable this feature during peak hours.
Examples
The Accept header used in this topic is for reference only. The actual Accept header shall prevail. In the following example, image/webp is included in the Accept header. This indicates that Alibaba Cloud CDN automatically converts images to the WebP format.
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9

Convert images to specified formats

Parameters

Set the action to format.

The following table describes the formats to which images can be converted.
Supported format Description
JPEG Converts base images to the JPG or JPEG format.
PNG Converts base images to the PNG format.
WEBP Converts base images to the WebP format.
BMP Converts base images to the BMP format.
GIF Converts base images to the TIFF format.
Note GIF images are animated. If you convert a GIF image to another format, the image is no longer animated and becomes static.
TIFF Converts base images to the TIFF format.
JPEG 2000 Converts base images to the JPEG 2000 format. The suffix of the names of JPEG 2000 images is JP2.
Examples
image_process=format,bmp