Image resizing includes resizing by percentage, conditional resizing, adaptive resizing, and resizing to a specific size. If a platform or an app has specific requirements for the size of images, such as a profile picture or thumbnail, you can resize images by dimension or percentage to meet different display requirements.
Parameters
Action: resize
The following table describes the parameters.
If one of the preceding parameters is set to a negative value, the image remains in its original size.
Parameter | Description | Valid value |
w | Specifies the width to which you want to resize the image. | The default value is 0. The total pixels of the image cannot exceed 16,777,216 pixels. |
h | Specifies the height to which you want to resize the image. | |
l | Specifies the length of the longer side to which you want to resize the image. | |
s | Specifies the length of the shorter side to which you want to resize the image. | |
fw and fh | Specifies the width and height to which you want to resize the image. | |
p | Specifies that the image is resized based on the original aspect ratio. | [0,100] |
Examples
The following table describes how to resize images.
Feature | Description | Example |
Based on a specific aspect ratio | Resize an image based on the original aspect ratio. |
|
Based on conditions | Resize an image only if the image is greater than or equal to 1,024,000 bytes in size. Unit: bytes. Note In this example, the threshold is set to 1,024,000. You can set the threshold based on your business requirements. |
|
Based on the longer side | Resize an image based on the specified length of the longer side. |
|
Based on the shorter side | Resize an image based on the specified length of the shorter side. |
|
Based on the width | Resize an image based on the specified width. |
|
Based on the height | Resize an image based on the specified height. |
|
Based on the specified height and width | Resize an image based on the specified height and width. |
|