Format conversion
Overview
Guide to image format conversion.
Format conversion parameter
Action name: format
| Parameters | Value | Description |
|---|---|---|
| f | jpg、png、bmp、webp、heic、gif、avif、auto | Specify the target image format |
If the value is auto, the optimal format will be automatically selected based on the Accept field in the request header. Currently, it supports adaptive as webp; if unable to match, the original image format will be retained. The response header will return Vary: Accept in accordance with HTTP specifications.
When using auto, a single link will have multiple cached replicas. If Baidu AI Cloud CDN is used, the CDN must enable the multi-replica caching function. If this function is not enabled, the CDN will cache the result of the first request. If the first request returns the webp format, browsers such as safari and ie will not be able to display the image. CDN domain names created after 01/01/2020 have this function enabled by default; domain names created before require a ticket to enable it.
Example
- For format adaptation, browsers that support webp (such as Chrome) will receive the webp format, while browsers that do not support webp will receive the original image format.
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/format,f_auto

