You can add Image Processing (IMG) parameters to GetObject requests to process image objects stored in Object Storage Service (OSS). For example, you can add image watermarks to images or convert image formats.
OSS allows you to directly use one or more parameters to process images. You can also encapsulate multiple IMG parameters in a style to batch process images. For more information about image styles, see Image styles.
When multiple IMG parameters are specified, OSS processes an image in the order of the parameters. The following table describes IMG parameters.
|Resize images||resize||Resizes images.|
|Add watermarks||watermark||Adds image or text watermarks to images.|
|Custom crop||crop||Crops rectangular images of the specified size.|
|Adjust image quality||quality||Adjusts the quality of images in the JPG and WebP formats.|
|Format conversion||format||Converts images to specified formats.|
|Query the EXIF data of an image||info||Queries image information, including basic information and Exchangeable Image File Format (EXIF) information.|
|Auto-rotate||auto-orient||Auto-rotates images for which the auto-orient parameter is configured.|
|Circle crop||circle||Crops images based on the center point of images to ellipses of the specified size.|
|Indexed cut||indexcrop||Cuts images along the specified horizontal or vertical axis and selects one of the images.|
|Rounded rectangle||rounded-corners||Crops images to rounded rectangles based on the specified rounded corner size.|
|Rotate||rotate||Rotates images clockwise based on the specified angle.|
|Gradual display||interlace||Converts JPG images to Progressive JPEG images.|
|Query the average tone||average-hue||Queries the average tone of images.|
|Brightness||bright||Adjusts the brightness of images.|
|Contrast||contrast||Adjusts the contrast of images.|
qualityparameters to the GetObjectthe request for the source image
example.jpg, the URL of the image is
https://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=image/resize,w_300/quality,q_90. You can configure Content Delivery Network (CDN) back-to-origin rules to filter or retain the IMG parameters contained in the URLs of images that you want to retrieve. This way, you can retrieve source images or images processed by specifying IMG parameters from OSS.
- Retrieve source images
You can enable Parameter Filtering for CDN to remove all IMG parameters that follow the question mark (?) in the URL of the image that you want to retrieve. In this case, the source image
- Retrieve processed images
You can enable Retain Specified Parameters for CDN to retain all IMG parameters that follow the question mark (?) in the URL of the image that you want to retrieve. In this case, the processed image is retrieved.
For more information about how to configure CDN back-to-origin rules, see Configure parameter filtering.
You can use object URLs, API operations, and OSS SDKs to process images. For more information, see IMG implementation modes.
- Limits on source images
- You can process only images of the JPG, PNG, BMP, GIF, WebP, TIFF, and formats.
- The size of the source image cannot exceed 20 MB.
- For the rotate operation, the height or width of the source image cannot exceed 4,096
pixels. For other operations on images, the width or height of the source image cannot
exceed 30,000 pixels, and the total pixel number of the source image cannot exceed
The total pixel number of a dynamic image, such as a GIF image, is calculated by using the following formula:
Width × Height × Number of image frames. The total pixel number of a static image, such as a PNG image, is calculated by using the following formula:
Width × Height.
- Limits on dynamic images
You can perform only the resize, crop, or rotate operations and add image watermarks on dynamic images such as GIFs.
- Limits on resized images
The width or height of a resized image cannot exceed 16,384 pixels. The total pixel number of the resized image cannot exceed 16,777,216.
- Limits on image styles
You can create up to 50 image styles in each bucket. To create more than 50 styles for a bucket, contact technical support.
- Request fees
A GetObject request is generated each time when you use IMG to process an image. You are charged based on the number of generated requests. For more information about request fees, see API fees.
- Traffic fees
You are charged for the outbound traffic over the Internet based on the size of the source images. For information about the billing details, see Traffic fees.
IMG provides two API versions: the later API version and the earlier API version. This topic describes the API of the later version. The API of the earlier version is no longer updated. For more information about the compatibility between the earlier and later versions of API, see FAQ on using old and new versions of APIs and domain names.