areaMinMaxRed()
Calculates the minimum and maximum red component value.
Declaration
class func areaMinMaxRed() -> any CIFilter & CIAreaMinMaxRedReturn Value
The generated image.
Discussion
This method applies the area-minimum-maximum-red filter to an image. This effect calculates the darkest and lightest red color value in the region defined by extent. The red and green components of the 1 x 1 pixel output image contain the result.
The area-minimum-maximum-red filter uses the following properties:
inputImageAn image with the type CIImage.
extentA 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 with the red and green color components populated:
func areaMinMaxRed(inputImage: CIImage) -> CIImage {
let filter = CIFilter.areaMinMaxRed()
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]