You can use format conversion parameters to convert an image to your desired format.
Parameters
Name | Description |
jpg | Saves the source image in JPG format. If the source image is a PNG, WebP, or BMP file with an alpha channel, the background is filled with black by default. Specify the 1wh parameter to fill the background with white. |
png | Saves the source image in PNG format. |
webp | Saves the source image in WebP format. |
bmp | Saves the source image in BMP format. |
gif | If the source image is a GIF, it is saved in GIF format. Images in other formats are saved in their original format. |
src | Returns the image in its original format. If the source image is a GIF, the first frame is returned and saved as a JPG. To save the image as a GIF, add the 1an parameter. |
Notes
The wh parameter applies only when you convert a four-channel PNG, WebP, or BMP image with a transparent background to the JPG format. This parameter fills the transparent background with white. Otherwise, the transparent background is filled with black.
When you save an image in JPG format, it is saved as a Baseline JPEG by default. To create a progressive JPEG, specify the 1pr parameter. For more information, see Gradual display.
Examples
Convert a PNG image to the JPG format. https://oss-console-img-demo-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/panda.png@.jpg

Convert a PNG image to the JPG format and fill the transparent background with white. https://oss-console-img-demo-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/panda.png@1wh.jpg

Convert a JPG image to a PNG image with a height of 100 pixels and a width of 100 pixels. https://oss-console-img-demo-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/example.jpg@100h_100w_2e.png

After a GIF image is saved, the original image is preserved. https://gosspublic.alicdn.com/example.gif

Create a thumbnail with a width of 100 pixels. Request URL: https://gosspublic.alicdn.com/example.gif@100w.gif

Alternatively, https://gosspublic.alicdn.com/example.gif@100w_1an.src