<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ImageIO",
  "identifier" : "/documentation/ImageIO/CGImagePropertyOrientation",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Image I/O"
    ],
    "preciseIdentifier" : "c:@E@CGImagePropertyOrientation"
  },
  "title" : "CGImagePropertyOrientation"
}
-->

# CGImagePropertyOrientation

A value describing the intended display orientation for an image.

```
@frozen enum CGImagePropertyOrientation
```

## Overview

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`](/documentation/ImageIO/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.

![To correct an image with right orientation for display, rotate it 90° clockwise.](images/com.apple.imageio/media-2948298.png)

### Compatibility with UIImageOrientation

The [`CGImagePropertyOrientation`](/documentation/ImageIO/CGImagePropertyOrientation) type covers the same set of orientation names available in from the <doc://com.apple.documentation/documentation/UIKit/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`](/documentation/ImageIO/CGImagePropertyOrientation), but an underlying value of 7 in <doc://com.apple.documentation/documentation/UIKit/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:

```objc
CGImagePropertyOrientation CGImagePropertyOrientationForUIImageOrientation(UIImageOrientation uiOrientation) {
    switch (uiOrientation) {
        case UIImageOrientationUp: return kCGImagePropertyOrientationUp;
        case UIImageOrientationDown: return kCGImagePropertyOrientationDown;
        case UIImageOrientationLeft: return kCGImagePropertyOrientationLeft;
        case UIImageOrientationRight: return kCGImagePropertyOrientationRight;
        case UIImageOrientationUpMirrored: return kCGImagePropertyOrientationUpMirrored;
        case UIImageOrientationDownMirrored: return kCGImagePropertyOrientationDownMirrored;
        case UIImageOrientationLeftMirrored: return kCGImagePropertyOrientationLeftMirrored;
        case UIImageOrientationRightMirrored: return kCGImagePropertyOrientationRightMirrored;
    }
}
UIImageOrientation UIImageOrientationForCGImagePropertyOrientation(CGImagePropertyOrientation cgOrientation) {
    switch (cgOrientation) {
        case kCGImagePropertyOrientationUp: return UIImageOrientationUp;
        case kCGImagePropertyOrientationDown: return UIImageOrientationDown;
        case kCGImagePropertyOrientationLeft: return UIImageOrientationLeft;
        case kCGImagePropertyOrientationRight: return UIImageOrientationRight;
        case kCGImagePropertyOrientationUpMirrored: return UIImageOrientationUpMirrored;
        case kCGImagePropertyOrientationDownMirrored: return UIImageOrientationDownMirrored;
        case kCGImagePropertyOrientationLeftMirrored: return UIImageOrientationLeftMirrored;
        case kCGImagePropertyOrientationRightMirrored: return UIImageOrientationRightMirrored;
    }
}
```

### 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`](/documentation/ImageIO/CGImagePropertyOrientation) type simply defines symbolic names for those values, so you can convert to and from the raw numeric type with C type-cast syntax or the inherited <doc://com.apple.documentation/documentation/Swift/RawRepresentable/init(rawValue:)> initializer and <doc://com.apple.documentation/documentation/Swift/RawRepresentable/rawValue-swift.property> property in Swift.

## Topics

### Image Orientations

[`CGImagePropertyOrientation.up`](/documentation/ImageIO/CGImagePropertyOrientation/up)

The encoded image data matches the image’s intended display orientation.

[`CGImagePropertyOrientation.upMirrored`](/documentation/ImageIO/CGImagePropertyOrientation/upMirrored)

The encoded image data is horizontally flipped from the image’s intended display orientation.

[`CGImagePropertyOrientation.down`](/documentation/ImageIO/CGImagePropertyOrientation/down)

The encoded image data is rotated 180° from the image’s intended display orientation.

[`CGImagePropertyOrientation.downMirrored`](/documentation/ImageIO/CGImagePropertyOrientation/downMirrored)

The encoded image data is vertically flipped from the image’s intended display orientation.

[`CGImagePropertyOrientation.leftMirrored`](/documentation/ImageIO/CGImagePropertyOrientation/leftMirrored)

The encoded image data is horizontally flipped and rotated 90° counter-clockwise from the image’s intended display orientation.

[`CGImagePropertyOrientation.right`](/documentation/ImageIO/CGImagePropertyOrientation/right)

The encoded image data is rotated 90° counter-clockwise from the image’s intended display orientation.

[`CGImagePropertyOrientation.rightMirrored`](/documentation/ImageIO/CGImagePropertyOrientation/rightMirrored)

The encoded image data is horizontally flipped and rotated 90° clockwise from the image’s intended display orientation.

[`CGImagePropertyOrientation.left`](/documentation/ImageIO/CGImagePropertyOrientation/left)

The encoded image data is rotated 90° clockwise from the image’s intended display orientation.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)