Enumeration

UIImageOrientation

A value describing the intended display orientation for an image.

Declaration

iOS, tvOS, watchOS
typedef enum UIImageOrientation : NSInteger {
    ...
} UIImageOrientation;
iOS, macOS, Mac Catalyst, tvOS
typedef enum UIImageOrientation UIImageOrientation;

Overview

Orientation values are commonly found in image metadata, and specifying image orientation correctly can be important both for displaying the image and for certain kinds of image processing.

The UIImage class automatically handles the transform necessary to present an image in the correct display orientation according to its orientation metadata, so an image object's imageOrientation property simply indicates which transform was applied.

For example, an iOS device camera always encodes pixel data in the camera sensor's native landscape orientation, along with metadata indicating the camera orientation. When UIImage loads a photo shot in portrait orientation, it automatically applies a 90° rotation before displaying the image data, and the image's imageOrientation value of UIImageOrientationRight indicates that this rotation has been applied.

Figure 1

UIImage rotates an image with right orientation for correct display

UIImage rotates an image with right orientation for correct display

Topics

Image Orientations

UIImageOrientationUp

The original pixel data matches the image's intended display orientation.

UIImageOrientationDown

The image has been rotated 180° from the orientation of its original pixel data.

UIImageOrientationLeft

The image has been rotated 90° counterclockwise from the orientation of its original pixel data.

UIImageOrientationRight

The image has been rotated 90° clockwise from the orientation of its original pixel data.

UIImageOrientationUpMirrored

The image has been horizontally flipped from the orientation of its original pixel data.

UIImageOrientationDownMirrored

The image has been vertically flipped from the orientation of its original pixel data.

UIImageOrientationLeftMirrored

The image has been rotated 90° clockwise and flipped horizontally from the orientation of its original pixel data.

UIImageOrientationRightMirrored

The image has been rotated 90° counterclockwise and flipped horizontally from the orientation of its original pixel data.

See Also

Image Attributes

imageOrientation

The orientation of the receiver’s image.

flipsForRightToLeftLayoutDirection

A Boolean value that indicates whether the image should flip in a right-to-left layout.

resizingMode

The resizing mode of the image.

UIImageResizingMode

Specifies the possible resizing modes for an image.

duration

Returns the time interval used to display an animated image.

capInsets

The end-cap insets.

alignmentRectInsets

The alignment metadata used to position the image during layout.

symbolImage

A Boolean value indicating whether the image is vector-based.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software