<!--
{
  "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/keystoneCorrectionCombined()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)keystoneCorrectionCombinedFilter"
  },
  "title" : "keystoneCorrectionCombined()"
}
-->

# keystoneCorrectionCombined()

Adjusts the image vertically and horizontally to remove distortion.

```
class func keystoneCorrectionCombined() -> any CIFilter & CIKeystoneCorrectionCombined
```

## Return Value

The adjusted image.

## Discussion

This method applies the keystone correction combined filter to an image. The effect applies a combined set of horizontal and vertical guides to adjust the shape of the input image. This effect is commonly used when cropping an image to correct distortion. In the figure below, both vertical and horizontal adjustments are made, resulting in a trapezoid-shaped image.

The keystone correction 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.
- `focalLength`: A `float` representing the simulated focal length as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.

The following code creates a filter that distorts the image:

```swift
func keystoneCorrectionCombined(inputImage: CIImage) -> CIImage {
    let keystoneCorrect = CIFilter.keystoneCorrectionCombined()
    keystoneCorrect.inputImage = inputImage
    keystoneCorrect.topLeft = CGPoint(x: 0, y: 2448)
    keystoneCorrect.topRight = CGPoint(x: 3164, y: 2248)
    keystoneCorrect.bottomLeft = CGPoint(x: 0, y: 0)
    keystoneCorrect.bottomRight = CGPoint(x: 3164, y: 150)
    keystoneCorrect.focalLength = 35
    return keystoneCorrect.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 keystone correction combined filter is applied, distorting the rectangular image to become a trapezoid.](images/com.apple.coreimage/media-3582223@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)