A value describing the intended display orientation for an image.
UIKit for Mac 13.0+Beta
Values of this type define the position of the pixel coordinate origin point (0,0) and the directions of the coordinate axes relative to the intended display orientation of the image. Orientation values are commonly found in image metadata, and specifying image orientation correctly can be important both for displaying the image and for certain image processing tasks such as face recognition.
For example, the pixel data for an image captured by an iOS device camera is encoded in the camera sensor's native landscape orientation. When the user captures a photo while holding the device in portrait orientation, iOS writes an orientation value of CGImagePropertyOrientation.right in the resulting image file. Software displaying the image can then, after reading that value from the file's metadata, apply a 90° clockwise rotation to the image data so that the image appears in the photographer's intended orientation.
Compatibility with UIImageOrientation
The CGImagePropertyOrientation type covers the same set of orientation names available in from the UIImage.Orientation type, but the underlying numeric values of each type do not match. (For example, the "left mirrored" orientation has an underlying value of 5 in CGImagePropertyOrientation, but an underlying value of 7 in UIImage.Orientation.) If you have an orientation value in one type and need a semantically equivalent value in the other, use a function such as those below to produce the same-named value in the other type:
Working with Raw TIFF/Exif Numeric Values
Some APIs describe image orientation with basic integer values, intended for interpretation according to the TIFF and Exif specifications. The CGImagePropertyOrientation type simply defines symbolic names for those values, so you can convert to and from the raw numeric type with the inherited init(rawValue:) initializer and rawValue property.
The encoded image data is rotated 90° clockwise from the image's intended display orientation.
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.