If your image format does not meet the requirements, such as excessive file size due to inappropriate format or image display errors due to specific requirements of different platforms, you can use format conversion to automatically convert images into the WebP format or into a specific format.
The image editing feature of Alibaba Cloud CDN, the image editing feature of Dynamic Content Delivery Network (DCDN), and the Image Processing (IMG) feature of Object Storage Service (OSS) are three different features.
Image editing is a paid service. It is free of charge until further notice.
The image processing feature is in private review. To use this feature, submit a ticket.
Automatic conversion to WebP
WebP supports both lossy compression and lossless compression. Dynamic Content Delivery Network (DCDN) can automatically convert images to the WebP format. After you enable automatic conversion to WebP, DCDN determines whether to convert images into the WebP format based on the Accept header in requests. If image/webp
is included in the Accept header, the images are converted into the WebP format and then cached. You can enable automatic conversion to WebP by following instructions in Enable image editing.
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.
Example
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 into 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
Format conversion parameters
Parameters
Set the action to format.
Value | Description |
jpeg | Converts base images into the JPG or JPEG format. |
png | Converts base images into the PNG format. |
webp | Converts base images into the WebP format. |
bmp | Converts base images into the BMP format. |
gif | Saves source images in the GIF format. If source images are not in the GIF format, they are saved in the original format. |
tiff | Converts base images into the TIFF format. |
jpeg 2000 | Converts base images into the JPEG 2000 format. The suffix of a JPEG 2000 image name is JP2. |
Example
If you want to convert the source image into the BMP format, the request URL is http(s)://example.com/image_01.png?image_process=format,bmp
.