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
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
- Set the border radius of the example JPG image to 100, and save it as PNG.
https://obs.region.example.com/image-demo/example.jpg?x-image-process=image/rounded-corners,r_100/format,png
- Set the horizontal radius of each rounded corner of the example JPG image to 100, and its vertical radius to 200.
https://obs.region.example.com/image-demo/example.jpg?x-image-process=image/rounded-corners,rx_100,ry_200
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot