Contents

crystallize()

Creates an image made with a series of colorful polygons.

Declaration

class func crystallize() -> any CIFilter & CICrystallize

Return Value

The modified image.

Discussion

This method applies the crystallize filter to an image. The effect creates polygon-shaped color blocks by aggregating pixel-color values.

The crystallize filter uses the following properties:

inputImage

An image with the type CIImage.

radius

A float representing the area of effect as an NSNumber.

center

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

The following code creates a filter that results in an image made of small polygons:

func crystalize(inputImage: CIImage) -> CIImage {
    let crystalizefilter = CIFilter.crystallize()
    crystalizefilter.inputImage = inputImage
    crystalizefilter.radius = 50
    crystalizefilter.center = CGPoint(x: 2016, y: 1512)
    return crystalizefilter.outputImage!
}

[Image]

See Also

Filters