<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/perspectiveTransform()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)perspectiveTransformFilter"
  },
  "title" : "perspectiveTransform()"
}
-->

# perspectiveTransform()

Alters an image’s geometry to adjust the perspective.

```
class func perspectiveTransform() -> any CIFilter & CIPerspectiveTransform
```

## Return Value

The adjusted image.

## Discussion

This method applies the perspective transform filter to an image. The effect alters the geometry of an image to simulate the observer changing viewing position. You can use the perspective filter to skew an image.

The perspective transform filter uses the following properties:

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `topLeft`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> in the input image mapped to the top-left corner of the output image.
- `topRight`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> in the input image mapped to the top-right corner of the output image.
- `bottomLeft`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> in the input image mapped to the bottom-left corner of the output image.
- `bottomRight`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> in the input image mapped to the bottom-right corner of the output image.

The following code creates a filter that changes the perspective of the input image:

```swift
func perspectiveTransform(inputImage: CIImage) -> CIImage {
    let perspectiveTransformFilter = CIFilter.perspectiveTransform()
    perspectiveTransformFilter.inputImage = inputImage
    perspectiveTransformFilter.topLeft = CGPoint(x: 100, y: 3984)
    perspectiveTransformFilter.topRight = CGPoint(x: 3732, y: 3025)
    perspectiveTransformFilter.bottomLeft = CGPoint(x: 0, y: 500)
    perspectiveTransformFilter.bottomRight = CGPoint(x: 4032, y: 120)
    return perspectiveTransformFilter.outputImage!
}
```

![Two photographs of a large building on the corner of an intersection. The building has small windows and is made of a brick structure. The photo on the left has no modifications to size or color. In the photo on the right, a perspective transform is applied, resulting in it appearing as though the photograph was taken from a different angle.](images/com.apple.coreimage/media-3582227@2x.png)

---

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)