This document helps you understand image cropping.
Operation Scenarios
ZOS supports image cropping. You can crop an image to the specified size using cropping parameters.
Constraints and Restrictions
Supported source formats: JPG, PNG, GIF, WebP, and TIFF.
The size of a source image cannot exceed 20 MB. The width or height cannot exceed 30,000 px, and total pixels cannot exceed 250 million px.
When the specified width and height exceed the source image boundaries, cropping will be limited to the image edge.
When parameter g is used with x and y, x and y will be offset according to the origin set by g.
Description
Operator: crop
Parameter Name | Purpose | Value | Required |
w | Specifies the cropping width. | [0,image width] | No |
h | Specifies the cropping height. | [0,image height] | No |
x | Specifies the horizontal coordinate of the cropping origin (default: top-left corner). | [0,image edge] | No |
y | Specifies the vertical coordinate of the cropping origin (default: top-left corner). | [0,image edge] | No |
g | Sets the cropping origin position | nw: top-left (default) | No |
Example
To crop an image starting at the bottom right of the source image and offset by (50,50), and crop a 300*300 image, the parameter setting should be: g_se,x_50,y_50,w_300,h_300.
The specific processing parameter is:
image/crop,x_50,y_50,w_300,h_300,g_se