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

Inscribed Circle

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

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. For details, see Table 1.

Operation name: circle

Table 1 Description for inscribed circle

Parameter

Value Description

Code Example

r

Circular radius of the cropped image, ranging [0, half of the shorter side of the image].

image/circle,r_100

  • If the image is output in JPG format, the area outside the inscribed circle is white. If the image is output in vector format such as PNG, WebP, and BMP, the area outside the inscribed circle is transparent. It is advisable to output the image in PNG format.
  • If r is larger than half of the shorter side, the inscribed circle output is still the largest inscribed circle of the image (with a radius equal to half of the shorter length).

Example

Set the radius of the cropped image to 100 and output the image in JPG format. Set the area outside the inscribed circle to white.

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