<!--
{
  "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/areaMaximumAlpha()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)areaMaximumAlphaFilter"
  },
  "title" : "areaMaximumAlpha()"
}
-->

# areaMaximumAlpha()

Finds the pixel with the highest alpha value.

```
class func areaMaximumAlpha() -> any CIFilter & CIAreaMaximumAlpha
```

## Return Value

A 1 x 1 size image containing the pixel with the maximum alpha value.

## Discussion

This filter returns the pixel with highest alpha value in the region defined by `extent`.

The area maximum alpha 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 results in a single pixel image containing the pixel with the highest alpha value:

```swift
func areaMaximumAlpha(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaMaximumAlpha()
    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!
}
```

![Two images side by side arranged horizontally. The left image is a photograph of a modern brick building. A square outline highlights a 500 x 500 pixel region in the image. The right image contains the result of running the area maximum alpha filter. It contains the color with the highest alpha value from the highlighted square.](images/com.apple.coreimage/media-4332167@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)