Contents

straighten()

Rotates and crops an image.

Declaration

class func straighten() -> any CIFilter & CIStraighten

Return 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:

inputImage

An image with the type CIImage.

angle

A float representing 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]

See Also

Filters