All Products
Search
Document Center

CDN:Resize images

Last Updated:Apr 01, 2026

Use the resize action to scale images to a specific width, height, or percentage. This is useful when your platform or app requires specific image sizes — for example, profile pictures, thumbnails, or assets for different screen densities.

The image editing feature of Alibaba Cloud CDN, the image editing feature of DCDN, and the Image Processing (IMG) feature of Object Storage Service (OSS) are three separate features and cannot be used interchangeably.
Image editing is free of charge until further notice.
Converting between image formats (for example, JPEG to WebP, or PNG to WebP) may produce a larger file because different formats use different compression algorithms. To reduce the output file size, set the quality parameter to lower the image quality.

Limits

  • The resize action only scales images down. If the target dimensions are larger than the original, the image is returned unchanged.

  • Setting any parameter to a negative value returns the image unchanged.

  • The total pixel count of the output image cannot exceed 16,777,216 pixels.

Parameters

Action: resize

ParameterFull nameDescriptionValid values
wWidthTarget width in pixels.Integer. Default: 0.
hHeightTarget height in pixels.Integer.
lLonger sideTarget length of the longer side.Integer.
sShorter sideTarget length of the shorter side.Integer.
fw and fhFixed width and heightTarget width and height to which you want to resize the image.Integer.
pPercentageTarget size as a percentage of the original dimensions. The aspect ratio is preserved.Integer, [0, 100].

Examples

All examples use image_process=resize as the query parameter to apply the resize action.

ScenarioExample URL
Scale to 80% of the original sizeexample.com/image01.png?image_process=resize,p_80
Scale only if the file is at least 1,024,000 bytesexample.com/image01.png?image_process=resize,l_200/threshold,1024000
Scale by longer side (200 px)example.com/image01.png?image_process=resize,l_200
Scale by shorter side (200 px)example.com/image01.png?image_process=resize,s_200
Scale by width (200 px)example.com/image01.png?image_process=resize,w_200
Scale by height (200 px)example.com/image01.png?image_process=resize,h_200
Scale to exact width and height (200 x 200 px)example.com/image01.png?image_process=resize,fw_200,fh_200
In the conditional resize example, threshold specifies the minimum file size in bytes. The image is resized only when its file size meets or exceeds the threshold. Adjust the value to match your requirements.