Image processing FAQ
This topic answers frequently asked questions (FAQs) about using the image processing (IMG) feature of Object Storage Service (OSS).
If an image fails to display correctly due to parameter issues, use the ?x-oss-process=image/info parameter to check its information. In OSS, the length of each side of an image cannot exceed 4,096 pixels, and the product of its width and height cannot exceed 4,096 × 4,096 pixels.
Why do different image processing parameters return the same ETag value?
In image processing, the ETag is a unique identifier for the source object. The ETag of a processed image is identical to the source object's ETag and does not change based on the processing operations.
Save processed images in multiple sizes
To store smaller versions of a source image, add the saveas parameter to your request to save the processed image to a specified bucket. For more information, see Save processed images.
Why an image is downloaded instead of previewed
If an image downloads instead of previewing in a browser, the browser may not support the image format. We recommend using a compatible browser, such as Google Chrome, to preview the image.
Why a dynamic GIF becomes static after processing
A dynamic GIF remains dynamic after resizing, cropping, or watermarking. However, other processing operations convert it into a static image.
"MemLimitExceeded" error during image processing
Cause: The image processing (IMG) service has size limits. For the rotate operation, the height or width of the source image cannot exceed 4,096 pixels. For other operations, the height or width cannot exceed 30,000 pixels, and the total number of pixels cannot exceed 250 million. If an image exceeds these limits, the "MemLimitExceeded" error occurs.
The total number of pixels for a dynamic image, such as a GIF image, is calculated as Width × Height × Number of frames. For a static image, such as a PNG image, it is calculated as Width × Height.
Solution: You can use the resize parameter to adjust the size of the image stored in OSS to meet the size limits. For more information about how to use the resize parameter, see Resize images.
"The channel can be only accessed using style" error
Cause: After you enable source image protection, anonymous users can access the source image only by using requests that include style parameters or by using a signed URL. This error occurs if you use image processing (IMG) parameters, such as ?x-oss-process=image/format,webp, in a request.
Solution: Disable source image protection for the image. For more information about source image protection, see Protect source images.
"Picture exceed the maximum allowable rotation range" error
Cause: This error typically occurs when the width or height of the source image exceeds the 4,096-pixel limit, or the product of the width and height exceeds 4,096 × 4,096.
Troubleshooting steps:
-
Use the
?x-oss-process=image/infoparameter to retrieve the image information and check if it exceeds the limits.
-
Check the
ImageWidthvalue. In this example, the value is 5100, which exceeds the 4,096-pixel limit.
Solution: Use the auto-orient,0 parameter to disable adaptive rotation, then use the resize parameter to adjust the image size before you rotate it. Ensure the final dimensions are within the allowed range. For example: http://test.oss-cn-beijing.aliyuncs.com/123/myphoto5.jpg?x-oss-process=image/auto-orient,0/resize,m_lfit,h_2000,w_2000,limit_1/rotate,90
Why non-compliant images remain accessible
Object Storage Service (OSS) does not automatically block access to non-compliant content. After an image is flagged for a violation and frozen, it is hidden from the console but remains in the bucket. You must manually delete the image to prevent access. For more information, see OSS violation detection.
Average tone from OSS does not match the image
Cause: The average tone is not a simple average of all pixel colors. Instead, it is calculated by identifying and averaging the most prominent colors in an image. The calculation logic is as follows:
-
Calculate the average hue of the image (avg_hue).
-
Identify prominent pixels where the color difference exceeds a threshold.
-
The average color of these prominent pixels is returned as the average tone.
Solution: Use the ?x-oss-process=image/average-hue parameter to query the average tone of an OSS image.
Black lines appear in image watermarks

Cause: Black lines may appear when you overlay one image on another to add an image watermark. This typically happens when the two images have different background RGB values. The lines result from this color mismatch and are not a bug in the image processing (IMG) service.
Use the ?x-oss-process=image/average-hue parameter to query the main color of an image. Append this parameter to the URL to check whether the RGB values of the two images are the same. For more information about RGB, see RGB.
Solution: In this example, the background image has an RGB value of "0x0e0e0e" and the watermark image's background is "0xffffff". This difference creates a border effect. To remove it, adjust the watermark transparency by using the t parameter (valid values: 1 to 100) to remove the border effect.
For example: http://image-demo.img-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=image/resize,w_300/watermark,image_cGFuZGEucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMzA,t_90,g_se,x_10,y_10,t_50
Increasing the transparency of the watermark can reduce the impact of the border effect.
Image processing fails on CDN origin fetch
If image processing (IMG) fails on an origin fetch from Alibaba Cloud CDN to OSS, first test access directly by using the OSS domain name. Use the following URLs for basic analysis:
http://test.oss-cn-beijing.aliyuncs.com/MomClass/ChuXin/3_2_336_462.jpg@30-30bl
http://test.img-cn-beijing.aliyuncs.com/MomClass/ChuXin/3_2_336_462.jpg@30-30bl
-
img-cn-region.aliyuncs.com is the legacy OSS domain name format. Its IMG delimiter and syntax differ from the newer
ossdomain name format. -
oss-cn-region.aliyuncs.com is the domain name format introduced after 2017. It is not compatible with the IMG syntax and "@" delimiter used by the
imgdomain name format. You must manually run synchronization in the OSS console.
To migrate the Gaussian blur effect from the legacy domain name format to the new OSS domain name format, you must reformat the request as follows:
http://test.oss-cn-beijing.aliyuncs.com/MomClass/ChuXin/3_2_336_462.jpg?x-oss-process=image/blur,r_3,s_30
Image becomes brighter after compression

Use a tool like Photoshop to check the source image's color model. If the source image uses the RGB color model, its color will not change after compression. If it uses the CMYK color model, color deviation may occur after compression. Support for the CMYK color model is limited.
"Corrupted image" error for a locally viewable image

An image opens correctly on your local computer, but image processing fails with a "corrupted image" error after you upload it to OSS.
Troubleshooting steps:
-
Use the
?x-oss-process=image/infoparameter with the original OSS URL to view the image information. If the request fails or reports an error, the source image is likely corrupted. -
Use the open-source ImageMagick tool to verify the issue. Attempt any modification on the image. If an
erroris reported, the image is corrupted. For example:convert -resize 1024x768 1123331261_15353307414801n.jpg
A corrupted image file may display correctly on a local machine because local image viewers often have built-in compensation to fix minor errors. OSS does not process corrupted images, so they cannot be displayed in a browser.
Image in OSS is rotated 90 degrees
Symptom: The image displays normally when accessed through an OSS domain name.
When accessed through Alibaba Cloud CDN, the image is rotated 90 degrees.
Cause: The normal access through OSS indicates that the object is stored correctly. The rotation occurs when you access the object through Alibaba Cloud CDN, which suggests the browser is adding a rotation parameter. Use the image processing parameter ?x-oss-process=image/info to check the image information, which shows the source image contains the rotation 90 parameter.
Solution: Remove the rotation parameter.
Image processing fails with CDN acceleration
Troubleshooting steps: Check if the Parameter Filtering feature is enabled for Alibaba Cloud CDN. This feature strips all URL parameters that appear after a question mark (?). For more information, see Ignore Parameters.
"Picture exceed the maximum allowable rotation range" error
Troubleshooting steps:
-
Use the ImageMagick tool to check if the source image has the
auto-orientattribute for adaptive rotation. -
Process the image by using the
auto-orient,0parameter. If the processing succeeds, the source image has the adaptive rotation attribute.
Blank image on iPhone with CDN acceleration
Cause: Because the image loads correctly on a computer, the issue is not with OSS. If it were an OSS issue, access from the computer would also fail.
Troubleshooting steps:
Try to access the image from the mobile phone directly through OSS.
-
If direct access is successful but access through Alibaba Cloud CDN fails, the issue may be a network problem with a CDN node or incorrectly cached content.
-
If direct access also fails, but access through Alibaba Cloud CDN works after a refresh, it may be a CDN cache issue.
Source and processed images cannot be opened
Follow these steps to use ImageMagick to troubleshoot an image in OSS:
-
Run the following command to download the sample image:
wget https://zh.mobi/test/123.jpgA sample success response is as follows.
--2018-11-22 10:55:16-- https://zh.mobi/test/123.jpg Resolving host zh.mobi (zh.mobi)... HTTP request sent, awaiting response... 200 OK Length: 4141232 (3.9M) [image/jpeg] Saving to: '123.jpg' 100%[========================================================================================>] 4,141,232 12.5MB/s in 0.3s 2018-11-22 10:55:16 (12.5 MB/s) - '123.jpg' saved [4141232/4141232] -
Download the ImageMagick tool.
-
Run the following command to check if the image has an encoding issue:
identify 123.jpgAn error response like the following indicates an image encoding error. This issue is not caused by storing the object in OSS. We recommend that you re-upload the image in the correct format.
identify: Not a JPEG file: starts with 0x000x00 `123.jpg' @ error/jpeg.c/JPEGErrorHandler/316.
Dividing line appears after image processing

Cause: The artifact is not a dividing line but an issue with the color composition after processing. The source image is a true-color RGB image with "ImageHeight": {"value": "2560"}, "ImageWidth": {"value": "1440"}. After processing, the pixels are cropped to a height of 1,920 and a width of 1,080. This compression of RGB pixel data causes the image to display abnormally.
Solution: Use the quality,Q_100 parameter to increase the absolute quality of the image to 100.
"BadRequest" error during image processing
<Error>
<Code>BadRequest</Code>
<Message>This image format is not supported.</Message>
<RequestId>62E2288D50ED1C30361E****</RequestId>
<HostId>examplebucket.oss-cn-beijing.aliyuncs.com</HostId>
</Error>
Troubleshooting steps:
-
Use the ImageMagick convert command to view the format of the original image.
-
Confirm whether OSS supports the image format. For more information about supported formats, see Limitations.
Solution: Convert the image to a format that OSS supports.
"InvalidArgument" error during image processing
<Error>
<Code>InvalidArgument</Code>
<Message>The value: 0 of parameter: w is invalid.</Message>
<RequestId>62E2288D50ED1C30361E****</RequestId>
<HostId>examplebucket.oss-cn-beijing.aliyuncs.com</HostId>
</Error>
If you encounter a parameter error while you process an image, first check the request parameters for the source image. For example, 2018089926****.jpg@0w_2e_1l_1an.src is a format supported by the legacy img-cn-xx domain name format. When you switch to the new oss-cn-xxx domain name format, the request methods for the legacy domain, such as the @ separator, are no longer supported. In addition, the legacy domain name format does not support HTTPS access. These incompatibilities cause the invalid parameter error.
"BadWebPImage" error during image processing
<Error>
<Code>BadWebPImage</Code>
<Message>The webp image file may be damaged.</Message>
<RequestId>62E2288D50ED1C30361E****</RequestId>
<HostId>examplebucket.oss-cn-beijing.aliyuncs.com</HostId>
</Error>
Causes:
-
The source image is a corrupted WebP image.
-
The source image is an uncorrupted dynamic WebP image, but your account is not on the allowlist for processing it.
Solution: Submit a ticket to be added to the allowlist to process uncorrupted dynamic WebP images.
Dynamic WebP images do not support the auto-orient parameter. You must remove or modify this parameter.
Custom query parameters for dynamic resizing
OSS does not support dynamically resizing images based on custom query parameters in requests.
Multi-line and multiple text watermarks
OSS does not support multi-line text watermarks. However, you can add multiple separate text watermarks to an image. For more information, see Add watermarks.
Why does the file size increase after resizing or cropping an image?
OSS generates a new image based on the specified image processing parameters. The processed file is not guaranteed to be smaller than the source image. PNG uses lossless compression. Resizing a PNG image can increase image complexity and compression cost, which can increase the file size even if the image is also cropped. The quality parameter does not apply to PNG images and is ignored.
Use the following steps to control the file size:
-
Compare the pixel dimensions and formats of the source and processed images to verify that the target dimensions are expected. If upscaling is enabled, avoid enlarging the image beyond the dimensions required by your business. For information about resize parameters and the
limitparameter, see Resize images. -
To reduce the file size of a PNG image, first use the
formatparameter to convert the image to JPG or WebP and then use thequalityparameter. For information about parameter order and format limits, see Image format conversion and Quality adjustment. JPG does not preserve transparency. Confirm that this behavior is acceptable for your application before conversion.
Adjust image properties to control storage
You can use the image processing (IMG) features of OSS, such as resizing, quality adjustment, and format conversion, to optimize image size and overwrite the original file to reduce storage usage. For more information, see IMG parameters, Image processing methods, and Save processed images.
versionId has no effect during image processing
The image processing (IMG) feature does not support object versioning. Therefore, you cannot specify a versionId to process a previous version of an image.