You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Image processing
Crop
Copy page
Download PDF
Crop
The crop feature allows you to select a rectangular area for cropping. You can define this area by its width and height. You can start cropping from any point on the original image. This topic introduces the parameters and provides examples of the crop feature.​
Supported parameters​
​
Parameter​
Description​
Value​
Required​
g​
The origin for cropping.​
  • nw (Default): Top left​
  • north: Top center​
  • ne: Top right​
  • west: Center left​
  • center: Center​
  • east: Center right​
  • sw: Bottom left​
  • south: Bottom center​
  • se: Bottom right​
No​
w​
The width of the crop.​
[0,Image width]​
Default: The maximum value.​
No​
h​
The height of the crop.​
[0,Image height]​
Default: The maximum value.​
No​
x​
The horizontal offset of the starting point (X-axis) relative to the specified origin (g).​
A positive value shifts the starting point to the right, while a negative value shifts the starting point to the left.​
No​
y​
The vertical offset of the starting point (Y-axis) relative to the specified origin (g).​
A positive value shifts the starting point down, while a negative value shifts the starting point up.​
No​
​
The following table describes how cropping origins are determined. In this table, srcW and srcH represent the width and height of the original image, respectively.​
​
Origin​
Coordinates​
nw​
0, 0​
north​
srcW/2 - w/2, 0​
ne​
srcW - w, 0​
west​
0, srcH/2 - h/2​
center​
srcW/2 - w/2, srcH/2 - h/2​
east​
srcW - w, srcH/2 - h/2​
sw​
0, srcH - h​
south​
srcW/2 - w/2, srcH - h​
se​
srcW - w, srcH - h​
​
Notes​
  • If the calculated origin falls outside the boundaries of the original image, a BadRequest error will be returned with the following message: "Advance cut's position is out of image".​
  • If the specified width and height exceed the image's boundaries from the origin, the crop will extend only to the image boundary.​
  • If a multi-frame image is provided, it will be converted to a single frame.​
Examples​
  • Use the default origin to crop, set the width and height to 400, and do not set an x or y offset.​
  • ​图片​​
  • Use the default origin to crop. Set the width and height to 400 and the X- and Y-offsets to 50.​
  • ​图片​​
​
Last updated: 2026.02.03 17:51:49