Contents

zoomBlur()

Creates a zoom blur centered around a single point on the image.

Declaration

class func zoomBlur() -> any CIFilter & CIZoomBlur

Return Value

The blurred image.

Discussion

This method applies the zoom blur filter to an image. This effect mimics the zoom of a camera when capturing the image.

The zoom blur filter uses the following properties:

amount

A float representing the zoom-in amount as an NSNumber.

center

A set of coordinates marking the center of the image as a CGPoint.

inputImage

A CIImage representing the input image to apply the filter to.

The following code creates a filter that adds a zoom blur to the input image:

    func zoomBlur(inputImage: CIImage) -> CIImage? {

        let zoomBlurFilter = CIFilter.zoomBlur()
        zoomBlurFilter.inputImage = inputImage
        zoomBlurFilter.amount = 5
        zoomBlurFilter.center = CGPoint(x: 150, y: 150)
        return zoomBlurFilter.outputImage
    }

[Image]

See Also

Filters