Format Conversion
Overview
Convert the image format.
Format Conversion Parameters
action name: format
Parameters | Value | Description |
---|---|---|
f | Jpg, png, bmp, webp, heic, gif, and auto | Specifies the format of the target image |
If the value is auto
, the optimal format is selected automatically according to the request Header’s Accept
field. The current support format is webp
. If failed to match the image, keep the original image format. The response header returns Vary: Accept
according to the HTTP specifications.
You need to pay particular attention that when the value is auto
, a single link has multiple cache replicas. If CDN is in use, you need to enable the multi-replica feature of the CDN; if failed to enable this feature, CDN caches the result of the first request. When the first request returns the webp
format, you cannot see the image in the browsers, such as safari and ie. For the CDN domain names created after January 1, 2020, this feature is enabled. For the domain names created before the date, you need to submit a ticket to enable this feature.
Example
- The format is adaptive. In the webp supported browsers (such as Chrome), return the webp format. In the browsers that do not support webp, return the original image format.
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg?x-bce-process=image/format,f\_auto