You can use the auto-orient parameter to specify whether source images stored in Object Storage Service (OSS) are rotated based on auto-rotate configurations. This topic describes the parameters and examples to rotate images when you configure auto-rotate.
Parameters
Operation name: auto-orient
The following table describes the parameters that you can configure when you configure auto-rotate.
Parameter | Description | Example |
---|---|---|
[value] | Specifies whether to perform auto-rotate. | 0 and 1. Default value: 1.
|
Usage notes
- If the source image does not have rotation parameters, the operation that you perform to set the auto-orient parameter does not affect the image.
- Most tools can be used to perform auto-rotate on images that have rotation parameters. Therefore, the images you view may be automatically rotated.
- Images that are processed by using auto-orient are re-compressed, which results in size differences between the processed images and the source images.
Examples
You can process images by using object URLs, OSS SDKs, or API operations. In this example, object URLs are used. For more information about how to use OSS SDKs and API operations to process images, see IMG implementation modes.
An image in the bucket named image-demo in the China (Hangzhou) region is used in this example. The following URL is used to access the image over the Internet:
https://image-demo.oss-cn-hangzhou.aliyuncs.com/f.jpg
- Resize the image and retain the orientation
Configure parameters to resize the image:
- Resize the image to a width of 100 pixels:
resize,w_100
- Disable auto-rotate:
auto-orient,0
The URL used to process the image is in the following format: https://image-demo.oss-cn-hangzhou.aliyuncs.com/f.jpg?x-oss-process=image/resize,w_100/auto-orient,0
- Resize the image to a width of 100 pixels:
- Resize and automatically rotate the image
Configure parameters to resize the image:
- Resize the image to a width of 100 pixels:
resize,w_100
- Automatically rotate the image:
auto-orient,1
The URL used to process the image is in the following format: https://image-demo.oss-cn-hangzhou.aliyuncs.com/f.jpg?x-oss-process=image/resize,w_100/auto-orient,1
- Resize the image to a width of 100 pixels: