Contents

areaMinMax()

Calculates minimum and maximum color components for a specified area of the image.

Declaration

class func areaMinMax() -> any CIFilter & CIAreaMinMax

Return Value

A 2 x 1 pixel image containing the minimum and maximum color components.

Discussion

This filter returns the maximum and minimum color components in the region defined by extent. The result is a 2 x 1 pixel image with the left pixel containing the minimum components and the right pixel containing the maximum components.

The area min max filter uses the following properties:

inputImage

An image with the type CIImage.

extent

A CGRect that specifies the subregion of the image that you want to process.

The following code creates a filter that results in a 2 x 1 image where the minimum components are in the left pixel and the maximum components are in the right pixel.

func areaMinMax(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaMinMax()
    filter.inputImage = inputImage
    filter.extent = CGRect(        x: inputImage.extent.width/2-250,
        y: inputImage.extent.height/2-250,
        width: 500,
        height: 500)
    return filter.outputImage!
}

[Image]

See Also

Filters