Contents

areaMinimumAlpha()

Calculates the pixel within a specified area that has the smallest alpha value.

Declaration

class func areaMinimumAlpha() -> any CIFilter & CIAreaMinimumAlpha

Return Value

A 1 x 1 pixel image containing the color with the smallest alpha value.

Discussion

This method applies the area minimum alpha filter to an image. This effect finds and returns the pixel with the lowest alpha value in the region defined by extent.

The area minimum alpha 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 1 x 1 pixel image containing the color with the lowest alpha value:

func areaMinimumAlpha(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaMinimumAlpha()
    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