pixellate()
Enlarges the colors of the pixels to create a blurred effect.
Declaration
class func pixellate() -> any CIFilter & CIPixellateMentioned 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:
inputImageAn image with the type CIImage.
centerA set of coordinates marking the center of the image as a CGPoint.
scaleA
floatrepresenting 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]