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 DCDN, and the Image Processing (IMG) feature of Object Storage Service (OSS) are three different features.
Image editing is free of charge until further notice.
When you use the image editing feature, conversion between different image formats, such as JPEG to WebP, JPEG to PNG, and PNG to WebP, may result in larger image sizes. This is because different image formats use different compression algorithms. If you want to reduce image sizes, we recommend that you configure the
quality
parameter to reduce the image quality.
Automatic conversion to WebP
WebP supports both lossy compression and lossless compression. Alibaba Cloud CDN can automatically convert images to the WebP format. After you enable automatic conversion to WebP, Alibaba Cloud CDN 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. For more information, see Enable and use image editing.
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
.