Updated on 2024-10-24 GMT+08:00

Rotating Images

Setting the Rotation

You can edit code on OBS Console or make an API call to rotate images clockwise.

Table 1 describes the parameters.

This operation is represented by rotate.

Table 1 Rotation description

Parameter

Value Description

Code Example

value

It defines the angle of a clockwise rotation and ranges from 0 to 360.

The default value is 0, which means the image is not rotated. A larger value means the image is clockwise rotated by a larger angle.

image/rotate,90

  • After rotation, dimensions of an image may increase.

Setting the Adaptive Orientation

You can use the GUI or code mode on OBS Console or make an API call to use adaptive orientation.

Images shot by cameras or smartphones may contain EXIF Data, like an orientation parameter. Since an image's rotation information is recorded in the orientation parameter, a browser can automatically rotate the image to the right position based on the orientation parameter.

With adaptive orientation configured, images that contain the orientation parameter will be rotated automatically. For details, see Table 2.

This operation is represented by auto-orient.

Table 2 Adaptive orientation description

Parameter

Value Description

Code Example

value

The value can be 0 or 1 (default value).

0: Adaptive orientation is not configured. The image will not rotate automatically and will keep the default orientation.

1: Adaptive orientation is configured. The image will rotate automatically before being resized.

image/resize,w_100/auto-orient,0

  • The adaptive orientation can be configured only when the height and width of an image are both smaller than 4,096.
  • If an image's EXIF data does not contain any rotation parameters or the image has no EXIF data at all, the auto-orient parameter does not work for the image.

Flipping Images

You can edit code on OBS Console or make an API call to flip images.

Images can be flipped horizontally or vertically. Table 3 describes the parameters.

This operation is represented by flip.

Table 3 Flipping description

Parameter

Value Description

Code Example

value

If this parameter is set to vertical, an image is flipped vertically.

If this parameter is set to horizontal, an image is flipped horizontally.

image/flip,vertical

  • After flipping, dimensions of an image may increase.