Updated on 2023-07-21 GMT+08:00

Rounded Corner Cropping

You can edit code on OBS Console or make an API call to get images with rounded corners.

This feature allows you to crop an image to a rounded rectangle by specifying the rounded corner size. The size can be configured by specifying the border radius and horizontal/vertical radius of each cropped rounded corner. For details, see Table 1.

Operation name: rounded-corners

Table 1 Description for rounded corner cropping

Parameter

Value Description

Code Example

r

Crop an image to a rounded corner rectangle, and specify the border radius of each corner. In this scenario, the horizontal radius and vertical radius are the same. Pixels (for example, 200) or percentage (for example, 25p) can be used as the unit.

The value of pixels ranges from 1 to 4096. When the value is greater than half of the pixel of the original image's shorter side, set this parameter to half of the pixel of the shorter side.

The value of percentage ranges from 1p to 50p.

This parameter cannot be used together with rx and ry.

image/rounded-corners,r_100

rx

Indicates the horizontal radius of a rounded corner. Pixels (for example, 200) or percentage (for example, 25p) can be used the unit.

The value of pixels ranges from 1 to 4096. When the value is greater than half of the pixel of the original image's shorter side, set this parameter to half of the pixel of the shorter side.

The value of percentage ranges from 1p to 50p.

This parameter must be used together with ry.

image/rounded-corners,rx_100,ry_200

ry

Indicates the vertical radius of a rounded corner. Pixels (for example, 200) or percentage (for example, 25p) can be used the unit.

The value of pixels ranges from 1 to 4096. When the value is greater than half of the pixel of the original image's shorter side, set this parameter to half of the pixel of the shorter side.

The value of percentage ranges from 1p to 50p.

This parameter must be used together with rx.

If the output image format is JPG, the cut-out corner area is white. If the output image format is PNG, WebP, or BMP, the cut-out corner area is transparent. You are advised to save the cropped images in PNG format.

Example