straighten()
Rotates and crops an image.
Declaration
class func straighten() -> any CIFilter & CIStraightenReturn Value
The adjusted image.
Discussion
This method applies the straighten filter to an image. The effect rotates the image based on the angle property while cropping and scaling the image to remain the same size as the original image.
The straighten filter uses the following properties:
inputImageAn image with the type CIImage.
angleA
floatrepresenting the angle to rotate the image as an NSNumber.
The following code creates a filter that rotates the image 135 degrees:
func straighten(inputImage: CIImage) -> CIImage {
let straightenFilter = CIFilter.straighten()
straightenFilter.inputImage = inputImage
straightenFilter.angle = 135
return straightenFilter.outputImage!
}[Image]