<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/areaMaximum()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)areaMaximumFilter"
  },
  "title" : "areaMaximum()"
}
-->

# areaMaximum()

Calculates the maximum color components of a specified area of the image.

```
class func areaMaximum() -> any CIFilter & CIAreaMaximum
```

## Return Value

A 1 x 1 size image containing the maximum color components.

## Discussion

This filter returns the maximum color components in the region defined by `extent`.

The area maximum filter uses the following properties:.

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `extent`:  A <doc://com.apple.documentation/documentation/CoreFoundation/CGRect> that specifies the subregion of the image that you want to process.

The following code creates a filter that calculates the maximum color components of a 500 x 500 set of pixels from the center of the image:

```swift
func areaMaximum(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaMaximum()
    filter.inputImage = inputImage
    filter.extent = CGRect(
        x: inputImage.extent.width/2,
        y: inputImage.extent.height/2,
        width: 100,
        height: 100)
     return filter.outputImage!
}
```

![Two images arranged horizontally. The left image contains a photograph of three hydrangea flowers with leaves in the background. A 500 x 500 pixel square in the center of the image is highlighted using an outlined box. The image on the right shows the result of applying the area maximum filter to the 500 x 500 pixel square. The result is a 1 x 1 pixel image containing a color made up of the maximum color components from the highlighted square.](images/com.apple.coreimage/media-4331784@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)