Image Cropping
Updated at:2025-11-03
Overview
This document introduces operations for image cropping.
Image cropping parameters
| Parameter name | Abbreviated command | Types | Value range | Command description | Default value | Required or not |
|---|---|---|---|---|---|---|
| crop | c | unsigned int | 0,1 | Specify whether to execute the cropping function on the image. c_1 indicates that the image will be cropped; c_0 indicates that the image will not be cropped; other cropping parameters will be invalid. |
- | No |
| offsetX | x | unsigned int | 0~4096 | Specify the x-coordinate for the top-left corner as the starting point for image cropping. | 0 | No |
| offsetY | y | unsigned int | 0~4096 | Specify the y-coordinate for the top-left corner as the starting point for image cropping. | 0 | No |
| width | w | unsigned int | 1~4096 | Specify the cropping width of the image. If the specified width exceeds the width of the image, the cropping will be based on the actual image width. The unit is px. |
Original image width | No |
| height | h | unsigned int | 1~4096 | Specify the cropping height of the image. If the specified height exceeds the height of the image, the cropping will be based on the actual image height. The unit is px. |
Original image height | No |
Example
- Crop the image starting from the top-left corner at coordinate (100, 150), with the cropping width and height defaulting to the original dimensions of the image.
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,x_100,y_150

- Crop the image starting from the top-left corner at coordinate (0, 0), specifying a cropping width of 600 and a cropping height of 600.
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,w_600,h_600

- Crop the image starting from the top-left corner at coordinate (100, 150), specifying a cropping width of 400 and a cropping height of 200.
https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,x_100,y_150,w_400,h_200

