Common Cropping
You can edit code on OBS Console or make an API call to crop images.
You can start at any point on an image and crop the image into a rectangle with specified width and height. Table 1 describes the parameters.
This operation is represented by crop.
Parameter |
Value Description |
Code Example |
---|---|---|
g |
The location where cropping starts. g can be set to tl, top, tr, left, center, right, bl, bottom, or br. Figure 1 shows a 3x3 grid illustrating these values. Each value locates at the top left corner of the cell. |
image/crop,x_10,y_10,w_200,h_200,g_br |
h |
Cropping height. Its value ranges from 0 to Original height. |
|
w |
Cropping width. Its value ranges from 0 to Original width. |
|
x |
x-coordinate of the start point. The top left corner is the default origin. The parameter value ranges from 0 to Original image width. |
|
y |
y-coordinate of the start point. The top left corner is the default origin. The parameter value ranges from 0 to Original image height. |
Figure 1 shows the cropping origins.
- If x is larger than the origin width, or y is larger than the origin height, the cropping cannot be executed and a fault will be returned.
- If h is larger than the origin height and w is larger than the original width, the image will be cropped to the boundaries.
Examples
- Set the start point of cropping to (1000, 500), and set both the width and height to 1000.
- Set the start point of cropping to (10, 10) in the bottom right (br) cell, and set both the width and height to 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