All Products
Search
Document Center

Object Storage Service:FAQ

Last Updated:Apr 11, 2024

This topic provides answers to some commonly asked questions about image processing (IMG) provided by Object Storage Service (OSS).

If the processed image cannot be properly displayed, you can use the ?x-oss-process=image/info parameter to query information about the source image and check whether the properties of the source image exceed the limits of IMG. The width and height of the image cannot exceed 4,096 pixels. The total pixel number of the image cannot exceed 4,096 × 4,096.

How do I fix an HEIC encoding error that is reported for image processing?

You need to add HEIC support to the whitelist. Your browser does not support HEIC previews and forces a download of an HEIC image when the image is requested.

Why does applying different IMG parameters to a source image produce images that have the same ETag?

ETag is the unique identifier of an image. Images produced after image processing have the same ETag as the source image.

How do I save processed images?

If you want to save small images other than the source images in a bucket, you can add the saveas parameter to an IMG request to save processed images to a bucket as objects. For more information, see Save processed images.

Why is an image downloaded when I use a browser to preview the image?

The possible reason is that the browser does not support the format of the image that you want to preview. We recommend that you use a browser that supports the format, such as Google Chrome, to preview the image.

Why does processing a GIF source image produce a static image?

Performing one or more of the following operations on a GIF image produces an image in the GIF format: resizing, cropping, and watermarking. If you perform IMG operations other than the preceding operations on a GIF image, the produced images are static.

What do I do if the "MemLimitExceeded" error is reported when I process an image?

Cause: IMG has image 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 of the source image cannot exceed 30,000 pixels, and the total pixel number of the source image cannot exceed 250 million. If the image size exceeds the limits, the "MemLimitExceeded" error is reported.

Note

The total number of pixels of a dynamic image, such as a GIF image, is calculated by using the following formula: Width × Height × Number of image frames. The total number of pixels of a static image, such as a PNG image, is calculated by using the following formula: Width × Height.

Solution: You can use the resize parameter to adjust the size of the image in OSS first. For more information, see Resize images.

What do I do if error message "The channel can be only accessed using style" is returned when I access an image?

Cause: After you enable source image protection for a bucket, anonymous requesters can access images in the bucket only by adding image style parameters in the requests or by using signed URLs. If you specify IMG parameters, such as ?x-oss-process=image/format,webp, in a request to process an image in a bucket for which source image protection is enabled, this error message is returned.

Solution: We recommend that you disable source image protection. For more information, see Protect source images.

What do I do if the "Picture exceed the maximum allowable rotation range" error message is returned when I rotate an image?

Cause: The width or height of the source image exceeds 4,096 pixels, or the total pixel number of the image exceeds 4,096 × 4,096.

Perform the following steps to troubleshoot the issue:

  1. Specify the ?x-oss-process=image/info parameter in the request to query information about the image.

  2. Check whether the image exceeds the width or height limit or the total size limit for the rotation operation. In this case, the value of ImageWidth is 5100, which exceeds the width limit of 4096 pixels.

Solution: Before you rotate the image, include the auto-orient,0 parameter in the request to disable automatic rotation and add the resize parameter in the request to resize the source image. Then, you can rotate the image. For example, you can use 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 to rotate the image.

What do I do if the average tone queried by OSS does not match that of the image?

Cause: The average tone is not calculated based on the ratios of colors but on the prominent colors of the image center. The average tone of an image is calculated based on the following rules:

  1. Calculate the average colors of the image.

  2. Traverse each pixel. Calculate the absolute value of the difference between the pixel color and each average color. If the absolute value is greater than a specific threshold, the pixel is added to the list of prominent pixels.

  3. Calculate the average value of the prominent pixels. The average value is the average tone.

Solution: Add the ?x-oss-process=image/average-hue parameter to the request to query the average tone of the image.

What do I do if black lines appear when I add an image watermark to an image?

Cause: The black lines are not caused by OSS IMG. When you add an image watermark to a source image, the source image is overlaid with the watermark. If the watermark and source image have different RGB values, black lines may appear around the source image after the source image is overlaid. This phenomenon is common when you use IMG tools.

Add the ?x-oss-process=image/average-hue parameter to the end of the URL of the source image to check whether the RGB values of the two images are the same.

Solution: Use the t parameter to remove the black lines. In this case, the RGB value of the source image is 0x0e0e0e. The RGB value of the image watermark is 0xffffff. When you add the image watermark to the image, the black lines appear. You can use the t parameter to adjust the transparency and make the black lines invisible. The value of t ranges from 1 to 100.

For example, you can use 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 to make the black lines invisible.

Note

You can increase the transparency to reduce the visibility of black lines.

What do I do if image processing does not take effect when I use Alibaba Cloud CDN to accelerate access to images that are stored in an OSS bucket?

Use OSS endpoints to check whether the image can be accessed. Use the following URLs to analyze the cause:

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 format of an earlier version of OSS endpoints. Earlier and later versions of OSS endpoints use different delimiters and syntax formats for IMG.

  • oss-cn-region.aliyuncs.com is the format of OSS endpoints available starting from 2017. This new endpoint format does not support the syntax of IMG or the at sign (@) used in the earlier version of endpoints. To access an image whose URL contains the earlier endpoint, update the URL with the latest OSS endpoint in the OSS console.

The earlier version of the endpoint in the preceding example uses Gaussian Blur-related parameters. After the earlier version of the endpoint is updated to the latest version, you can achieve the same IMG effect by using the following URL:

http://test.oss-cn-beijing.aliyuncs.com/MomClass/ChuXin/3_2_336_462.jpg?x-oss-process=image/blur,r_3,s_30

What do I do if the image colors are brightened after the image is resized?

Solution: Use tools such as Photoshop to query the color model of the source image. If the source image uses the RGB color model, the colors remain unchanged after the image is resized. If the source image uses the CMYK color model, the resized image has color deviations. OSS does not support the CMYK color model. As a result, resizing an image that uses the CMYK color model produces an image that has color deviations.

Why does an image that can be opened from my local computer fail to be processed in OSS with an image corruption error?

Problem description: My image can be opened from my local computer. However, OSS shows that the image is corrupted when I upload the image to OSS and process the image.

Perform the following steps to troubleshoot the issue:

  1. Obtain the URL of the source image and use ?x-oss-process=image/info to query information about the source image. If no results are returned and an error is returned, the source image is corrupted.

  2. To check whether the image is corrupted, use ImageMagick to make any adjustment to the source image. If error is returned, the image is corrupted. The following sample code provides an example on how to resize the image:

    convert -resize 1024x768 1123331261_15353307414801n.jpg

The corrupted image can be opened on the local computer because the local image viewer repairs the image. OSS does not repair corrupted images. As a result, the image cannot be displayed by the browser.

What do I do if the image stored in OSS is rotated 90 degrees?

Problem description: The image is accessible and does not appear rotated by using an OSS endpoint of the region in which the image is stored.图片旋转前

When the image is accessed over CDN, the image appears rotated 90 degrees.图片旋转90度

Cause: The image is displayed as expected when it is directly accessed, which indicates that the image is correctly stored in OSS. When the image is accessed over CDN, the image is rotated. The rotation is caused by the browser. You can use ?x-oss-process=image/info to query information about the image and check whether the rotation 90 parameter is included in the image information.

Solution: Delete the rotation parameter.

What do I do if IMG does not take effect after Alibaba Cloud CDN is used to access an image?

Check whether the parameter filtering feature is enabled in Alibaba Cloud CDN. If this feature is enabled, parameters that follow the question mark (?) are removed from the URL. For more information, see Ignore parameters.

What do I do if the "Picture exceed the maximum allowable rotation range" error message is returned when I use IMG to process an image?

Perform the following steps to troubleshoot the issue:

  • Use the ImageMagick tool to check whether the source image has the auto-orient attribute.

  • Use the auto-orient,0 parameter to process the image. If the image can be processed, automatic rotation is enabled for the source image.

If automatic rotation is enabled for the source image, the width and height of the image cannot exceed 4,096 pixels.

What do I do if a blank image appears when I use Alibaba Cloud CDN to access an image from an iPhone by using a URL that includes IMG parameters, but I can access the image from a computer or after I refresh the web page?

Cause: You can exclude OSS service exceptions from possible causes because the image can be accessed from a computer, but not from a mobile phone. If an OSS service exception occurs, access from a computer also fails.

Perform the following steps to troubleshoot the issue:

  1. Check whether the image can be directly accessed from a mobile phone.

    • If the image can be directly accessed from a mobile phone, but cannot be accessed by using Alibaba Cloud CDN, the content cache of the image on Alibaba Cloud CDN points of presence (POPs) may be invalid or a loading failure may occur due to POP connection errors.

    • If the image cannot be directly accessed from a mobile phone, but can be accessed by using Alibaba Cloud CDN after a refresh operation, incorrect content may be cached on CDN POPs.

  2. Check whether the image can be directly accessed from a computer.

    • If the image can be directly accessed from a computer, the cause may be related to the mobile phone.

    • If the image cannot be directly accessed from a computer, the cause may be related to the image.

What do I do if I cannot open the source image and processed image that are stored in OSS?

Use the ImageMagick tool to check whether the image has an encoding problem. The following troubleshooting steps describe how to use ImageMagick to check the demo image 123.jpg for image encoding errors:

  1. Run the following command to download the demo image:

    wget https://zh.mobi/test/123.jpg                  

    Sample success response:

    --2018-11-2210:55:16--  https://zh.mobi/test/123.jpg
    The IP address of the zh.mobi host is being resolved...
    The host has sent an HTTP request and is waiting for a response... 200 OK
    Image size: 4141232 (3.9M) [image/jpeg]
    Saving as 123.jpg...
    100%[========================================================================================>] 4,141,232 12.5 MB/s Time: 0.3s.   
    2018-11-2210:55:16 (12.5 MB/s) - "123.jpg" is saved [4141232/4141232])
  2. Download ImageMagick.

  3. Run the following command to check the encoding of the image:

    identify 123.jpg                        

    The following sample error response is returned. The response indicates that the image has an encoding error. The error is not caused by OSS. You can use ImageMagick to analyze similar errors.

    identify: Not a JPEG file: starts with 0x000x00 `123.jpg' @ error/jpeg.c/JPEGErrorHandler/316.

What do I do if a dividing line appears after I process my image?

图片带分割线

Cause: What appears to be a dividing line in the figure is actually not a dividing line. It is caused by pixel changes after the image is processed. The source image is an RGB (true color) image whose height is 2,560 pixels and width is 1,440 pixels. After the image is processed, the image height is cropped to 1,920 pixels and the image width is cropped to 1,080 pixels. The image size in pixels is reduced, which causes the abnormal display of the image.

Solution: Use the quality,Q_100 parameter to increase the absolute quality value of the image to 100.

What do I do if the "BadRequest" error code is returned 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>

Perform the following steps to troubleshoot the issue:

  1. Use the convert command of ImageMagick to view the format of the source image.

  2. Check whether the image format is supported. For more information about the supported image formats, see Limits.

Solution: Convert the format of the image to a supported format.

What do I do if the "InvalidArgument" error code is returned 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>

Check the parameters in the request. For example, parameters specified in 2018089926****.jpg@0w_2e_1l_1an.src are supported only by endpoints in the img-cn-xx format. Endpoints in the oss-cn-xxx format do not support the syntax for requests that use the original img endpoint. In addition, access over HTTPS is not supported for the original endpoint format.

What do I do if the "BadWebPImage" error code is returned 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, dynamic WebP image.

  • The source image is an uncorrupted, dynamic WebP image. However, you do not have permissions to process WebP images.

Solution: Submit a ticket to apply for permissions to process dynamic WebP images.

Note

The auto-orient parameter is not applicable to dynamic WebP images. When you process dynamic WebP images, do not add the auto-orient parameter.

Can OSS identify custom query parameters used in a URL to dynamically resize an image?

OSS cannot identify custom query parameters used in a URL to dynamically resize an image.

Can I display a text watermark in two lines and add multiple text watermarks to an image?

A text watermark cannot be displayed in multiple lines in OSS. However, you can add multiple text watermarks to an image. For more information, see Add watermarks.

How do I adjust image attributes to reduce the storage usage of images?

Note

To optimize storage usage and reduce costs, we recommend that you use OSS lifecycle rules to automatically convert the storage class of the images to a cost-effective storage class and periodically delete objects that are no longer needed, instead of adjusting image attributes and overwriting the source image. For more information, see Cost management.

You can use IMG operations, such as resizing, quality adjustment, and format conversion, to optimize the image size and overwrite the source images to reduce storage usage. For more information, see IMG parameters, IMG implementation modes, and Save processed images.

When I specify a version ID in an IMG request to process a previous version of an image, why does the signed URL direct to the latest version of the image instead of the specified version?

IMG does not allow you process a previous version of an image. You cannot specify a version ID in an IMG request to process a previous image version.