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

Inscribed Circles

You can edit code on OBS Console or make an API call to get an inscribed circle of an image.

Choose the image center as the center of a circle, and crop the image according to the specified radius. The image then is cropped into a circle. Table 1 describes the parameters.

This operation is represented by circle.

Table 1 Inscribed circle parameters

Parameter

Value Description

Code Example

r

Radius specified for the inscribed circle. Its value ranges from 0 to Half of the image's short side.

image/circle,r_100

  • If the output format is set to JPG, the area outside the inscribed circle is white. If the output format is set to a vector format such as PNG, WebP, or BMP, the area outside the inscribed circle is transparent. PNG is the recommended output format.
  • Even if r is larger than half of the short side, the generated inscribed circle is still the image's largest inscribed circle (with a radius equal to half of the short side).

Example

Set the radius to 100 and output format to jpg (with the area outside the inscribed circle being white).

https://hw-image-demo.obs.ap-southeast-1.myhuaweicloud.com/example.jpg?x-image-process=image/circle,r_100