You can use the format parameter to convert the format of a source image stored in Object Storage Service (OSS). This topic describes the parameter and provides examples on how to convert the format of an image.

Parameter description

Parameter name: format

The following table describes the valid values of the format parameter.

Valid value Description
jpg Saves the source image in the JPG format. By default, OSS fills the transparent area in white if the source image is in the PNG, WebP, or BMP format that supports alpha channels.
Notice Images in the HEIC format that support alpha channels cannot be saved in the JPG format.
png Saves the source image in the PNG format.
webp Saves the source image in the WebP format.
bmp Saves the source image in the BMP format.
gif Saves the source image in the GIF format. If the source image is not in the GIF format, it is saved in its original format.
tiff Saves the source image in the TIFF format.

Usage notes

  • When you perform a standard resize operation on an image, we recommend that you add the format parameter to the end of the last Image Processing (IMG) parameter.

    Example: image/resize,w_100/format,jpg

  • When you resize and watermark an image, we recommend that you add the format parameter to the end of the resize parameter.

    Example: image/reisze,w_100/format,jpg/watermark,...

Examples

In these examples, an image in the bucket named image-demo in the China (Hangzhou) region is used. The following URL is used to access the image over the Internet: