You can round the corners of a rectangle image stored in Object Storage Service (OSS) by using the rounded-corners operation. This topic describes the parameter of the rounded-corners operation and provides examples on how to round the corners of a rectangle image.

Parameters

Operation name: rounded-corners

The following table describes the parameter that you can configure.

ParameterDescriptionValue range
rThe radius of the corners. [1,4096]

Usage notes

  • If the final format (PNG, WebP, or BMP) of an image supports alpha channels, the areas of the image outside the rounded rectangle become transparent. If the final format of the image is JPG, the areas of the image outside the rounded rectangle become white. We recommend that you save the processed image in the PNG format.
  • If the specified radius for the rounded corners is greater than the radius of the largest incircle of the source image, the radius of the largest incircle of the source image is used as the radius to round the corners. In this case, the radius of the corners is equal to half of the shortest edge of the source image.
  • The rounded-corners operation is not supported for GIF images.

Examples

You can use object URLs, OSS SDKs, or API operations to configure IMG parameters that are used to process images. In this example, object URLs are used. You can use object URLs to configure IMG parameters only for public-read images. If you want to configure IMG parameters for private images, use OSS SDKs or API operations. For more information, see IMG implementation modes.

This topic provides examples on how to round the corners of an image in the oss-console-img-demo-cn-hangzhou bucket in the China (Hangzhou) region. The image is hosted at the following URL: