Zettabyte Object Storage

Cropping Images

2026-01-26 02:28:32

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]
    Default: maximum value

No

h

Specifies   the cropping height.

[0,image   height]
    Default: maximum value

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
    The origin is arranged in a nine-grid pattern with nine possible   positions,   each representing the top-left vertex of each grid cell.

nw:   top-left (default)
    north: top-center
    ne: top-right
    west: middle-left
    center: center
    east: middle-right
    sw: bottom-left
    south: bottom-center
    se: bottom-right

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

 

 


Qty7cyOpDAEx