Contents

pixellate()

Enlarges the colors of the pixels to create a blurred effect.

Declaration

class func pixellate() -> any CIFilter & CIPixellate

Mentioned in

Return Value

The modified image.

Discussion

This method applies the pixelate filter to an image. The effect produces a result by mapping the image to colored squares with colors defined by the pixels of the input image.

The pixelate filter uses the following properties:

inputImage

An image with the type CIImage.

center

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

scale

A float representing the size of the squares as an NSNumber.

The following code creates a filter that results in a distorted image made of squares:

func pixelate(inputImage: CIImage) -> CIImage {
    let pixelate = CIFilter.pixellate()
    pixelate.inputImage = inputImage
    pixelate.center = CGPoint(x: 150, y: 150)
    pixelate.scale = 30
    return pixelate.outputImage!
}

[Image]

See Also

Filters