You can enable basic features such as adaptive WebP conversion, automatic rotation (auto-correction only), and automatic compression directly in the console. For advanced operations such as image cropping and watermarking, add image editing parameters to the request URL.
CDN image editing, DCDN image editing, and Object Storage Service (OSS) Image Processing (IMG) are three separate features. Image editing is free of charge until further notice.
Format conversion
Converting between formats may increase file size because different formats use different compression algorithms. For example, converting JPEG to WebP, JPEG to PNG, or PNG to WebP can produce a larger output. To reduce the output file size, set the quality parameter to lower the image quality.
Enable image editing
-
Log on to the CDN console.
-
In the left navigation pane, click Domain Names.
-
On the Domain Names page, find the target domain name and click Manage in the Actions column.
-
In the domain's navigation pane, click Optimization.
In the Image Editing section, turn on the Image Editing switch, and select the image formats that you want to convert.
NoteThe image editing feature is enabled after you select the supported formats. Once enabled, image editing parameters in a URL take effect when you process images with file URLs.
You can decide whether to enable automatic conversion to WebP, automatic rotation (for auto-correction only), and automatic compression in the console.
Parameter
Description
Supported Image Formats
Select the image formats that you want to convert. This parameter is required, and you can select multiple formats.
Automatic Conversion to WebP
If this feature is enabled and the request's Accept header contains
image/webp, Alibaba Cloud CDN automatically converts images from other formats to WebP before caching them.NoteEnabling this feature may temporarily decrease the cache hit ratio. The ratio will return to normal after a short period. Do not enable this feature during peak business hours.
Automatic Rotation
Enables automatic correction of image orientation.
NoteAutomatic rotation applies only when the
auto-orientparameter is used.Enabling this feature may temporarily decrease the cache hit ratio. The ratio will return to normal after a short period. Do not enable this feature during peak business hours.
Automatic Compression
When enabled, this feature allows Alibaba Cloud CDN to compress images and reduce bandwidth usage without changing their resolution, dimensions, or format.
0 (default): Disables the feature.
1 to 100: Enables the feature. For example, a value of 90 means the image quality is retained at 90% of the original.
NoteThis feature supports only the JPEG and WebP formats.
Source Image Cache
If a source image has multiple converted copies, enabling source image cache reduces the number of origin requests.
Click OK to complete the setup.
Process images using file URLs
Select the supported image formats by following the instructions in Enable image editing.
Add parameters to the request URL to perform custom operations.
Format:
http://example.com/image_01.png?image_process=action,param_value/action,param_valueField
Description
example.com
Your accelerated domain name.
image_01.png
The name of the image.
image_process
A fixed parameter that indicates an image editing operation.
action,param_value
The action and value that define an operation. You can specify multiple operations by separating them with forward slashes (/). Alibaba Cloud CDN applies them in the order they are listed. For more information about the supported parameters, see Image editing parameters.
Example:
http://example.com/image_01.png?image_process=resize,w_200/rotate,90/format,webp. Result: The image is first scaled proportionally to a width of 200 pixels, then rotated 90° clockwise, and finally saved in WebP format.
Image editing parameters
Add parameters to a request URL to perform various image editing operations. You can use one or more parameters in a single URL.
Image editing feature | Parameter | Description |
format | Converts the image format. | |
quality | Adjusts the image quality. | |
crop | Crops the image to a specified size. | |
resize | Resizes the image to the specified dimensions. Upscaling is not supported. | |
| Automatically corrects the orientation of an image with an orientation tag, or rotates an image clockwise by a specified angle. | |
| Adjusts the brightness, contrast, and sharpness of the image. | |
watermark | Adds a picture or text watermark to an image. | |
info | Retrieves image information, such as width, height, format, and quality. |