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
- To enable image editing, submit a ticket.
- 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
Examplesimage/webp
is included in the Accept header, images are converted to WebP format. Important 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.
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 specifies 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 GIF 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 a JPEG 2000 image name is JP2. |
Examples
image_process=format,bmp