Updated on 2024-08-09 GMT+08:00

Indexcropping

You can edit code on OBS Console or make an API call to indexcrop images.

Set the top left corner of the image as the starting point. Set x-axis overlapping with the width, and y-axis overlapping with the height. Crop the image into several consecutive partitions horizontally or vertically, each having equal width or height. Get the partition you want according to the index. Table 1 describes the parameters.

This operation is represented by indexcrop.

Table 1 Indexcropping parameters

Parameter

Value Description

Code Example

x

Width of each partition in horizontal cropping, ranging from 1 to Original image width. x and y cannot be chosen at the same time.

image/indexcrop,x_1000,i_0

y

Height of each partition in vertical cropping, ranging from 1 to Original image height.

x and y cannot be chosen at the same time.

i

If there are n partitions in total, the value of i ranges from 0 to n–1. When i is set to 0, you obtain the first partition. If you set i to a value larger than n–1, the original image will be returned.

Examples