Type Method

zoomBlur()

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

Declaration

class func zoomBlur() -> 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
    }
Two photographs of a beach at sunset with multiple palm trees. The photo on the left is clear and crisp. In photo on the right, a zoom blur filter has been applied resulting in a distorted and fuzzy image.

See Also

Filters

class func bokehBlur() -> CIFilter & CIBokehBlur

Applies a bokeh effect to an image.

class func boxBlur() -> CIFilter & CIBoxBlur

Applies a square-shaped blur to an area of an image.

class func discBlur() -> CIFilter & CIDiscBlur

Applies a circle-shaped blur to an area of an image.

class func gaussianBlur() -> CIFilter & CIGaussianBlur

Blurs an image with a Gaussian distribution pattern.

class func median() -> CIFilter & CIMedian

Calculates the median of an image to refine detail.

class func morphologyMaximum() -> CIFilter & CIMorphologyMaximum

Blurs a circular area by enlarging contrasting pixels.

class func morphologyMinimum() -> CIFilter & CIMorphologyMinimum

Blurs a circular area by reducing contrasting pixels.

class func morphologyRectangleMaximum() -> CIFilter & CIMorphologyRectangleMaximum

Blurs a rectangular area by enlarging contrasting pixels.

class func morphologyRectangleMinimum() -> CIFilter & CIMorphologyRectangleMinimum

Blurs a rectangular area by reducing contrasting pixels.

class func noiseReduction() -> CIFilter & CINoiseReduction

Reduces noise by sharpening the edges of objects.