Updated on 2024-08-09 GMT+08:00

Rounded Corner Cropping

You can edit code on OBS Console or make an API call to round corners of an image.

This operation allows you to cut off the corners of an image based on the specified radiuses. You can configure the radius of image corners to round in two ways. For details, see Table 1.

This operation is represented by rounded-corners.

Table 1 Rounded corner parameters

Parameter

Value Description

Code Example

r

It indicates both horizontal and vertical radiuses of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

r cannot be used together with rx or ry.

image/rounded-corners,r_100

rx

It indicates the horizontal radius of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

rx must be used together with ry.

image/rounded-corners,rx_100,ry_200

ry

It indicates the vertical radius of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

ry 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 rounded corner images in PNG.

Examples