Baidu AI Cloud
中国站

百度智能云

Object Storage

Image Cropping

Overview

This article describes photo cropping operations.

Photo Cropping Parameter

Parameter name Resizing command Type Value range Request description Default value Is it required
crop c unsigned int 0,1 Designate whether the photo can be cropped.
c_1 means the photo is cropped;
c_0 means the photo is not cropped,
Other cropping parameters are invalid.
- No
offsetX x unsigned int 0~4096 Designate the x coordinate of the starting point of the upper left clipping corner of the photo. 0 No
offsetY y unsigned int 0~4096 Designate the y coordinate of the starting point of the upper left clipping corner of the photo. 0 No
width w unsigned int 1~4096 Designate the cropping width of the photo.
If the specified width exceeds the
width of the photo, the width of the photo shall prevail.
The unit will be px.
The width of the original photo No
height h unsigned int 1~4096 Designate the cropping height of the photo.
If the specified height exceeds the
height of the photo, the height of the photo shall prevail.
The unit will be px.
The height of the original photo No

Example

  • The photo should be cropped from the top left corner of the photo from the point with a horizontal coordinate of 100 and a vertical coordinate of 150, besides, the width and height of the crop should be the width and height of original photo by default.

https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,x_100,y_150

  • The photo should be cropped from the top left corner of the photo from the point with a horizontal coordinate of 0 and a vertical coordinate of 0 with both the designated cropping width and height of 600.

https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,w_600,h_600

  • The photo should be cropped from the top left corner of the photo from the point with a horizontal coordinate of 100 and a vertical coordinate of 150 with the designated cropping width of 400 and the designated cropping height of 200.

https://doc.bce.baidu.com/bce-documentation/BOS/image.jpg@c_1,x_100,y_150,w_400,h_200

Previous
Image Thumbnail
Next
Image Rotation