---
title: perspectiveTransformWithExtent()
framework: coreimage
role: symbol
role_heading: Type Method
path: coreimage/cifilter-swift.class/perspectivetransformwithextent()
---

# perspectiveTransformWithExtent()

Alters an image’s geometry to adjust the perspective while applying constraints.

## Declaration

```swift
class func perspectiveTransformWithExtent() -> any CIFilter & CIPerspectiveTransformWithExtent
```

## Return Value

Return Value The adjusted image.

## Discussion

Discussion This method applies the perspective transform with extent filter to an image. The effect alters the geometry of an image to simulate the observer changing viewing position. The extent filter crops the image within the bounds specified. You can use the perspective filter to skew an image. The perspective transform with extent filter uses the following properties: The following code creates a filter that changes the perspective of the input image: func perspectiveTransformWithExtent(inputImage: CIImage) -> CIImage {     let perspectiveTransformFilter = CIFilter.perspectiveTransformWithExtent()     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)     perspectiveTransformFilter.extent = CGRect(x: 0, y: 0, width: 3800, height: 3200)     return perspectiveTransformFilter.outputImage! }

## See Also

### Filters

- [bicubicScaleTransform()](coreimage/cifilter-swift.class/bicubicscaletransform().md)
- [edgePreserveUpsample()](coreimage/cifilter-swift.class/edgepreserveupsample().md)
- [keystoneCorrectionCombined()](coreimage/cifilter-swift.class/keystonecorrectioncombined().md)
- [keystoneCorrectionHorizontal()](coreimage/cifilter-swift.class/keystonecorrectionhorizontal().md)
- [keystoneCorrectionVertical()](coreimage/cifilter-swift.class/keystonecorrectionvertical().md)
- [lanczosScaleTransform()](coreimage/cifilter-swift.class/lanczosscaletransform().md)
- [perspectiveCorrection()](coreimage/cifilter-swift.class/perspectivecorrection().md)
- [perspectiveRotate()](coreimage/cifilter-swift.class/perspectiverotate().md)
- [perspectiveTransform()](coreimage/cifilter-swift.class/perspectivetransform().md)
- [straighten()](coreimage/cifilter-swift.class/straighten().md)
