<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIContext/calculateHDRStats(for:)-l1rj",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIContext(im)calculateHDRStatsForImage:"
  },
  "title" : "calculateHDRStats(for:)"
}
-->

# calculateHDRStats(for:)

Given a Core Image image, use the receiving Core Image context to calculate its
HDR statistics (content headroom and content average light level)
and then return a new Core Image image that has the calculated values.

```
func calculateHDRStats(for image: CIImage) -> CIImage?
```

## Parameters

`image`

An immutable [`CIImage`](/documentation/CoreImage/CIImage) for which to calculate statistics.

## Return Value


Returns a new [`CIImage`](/documentation/CoreImage/CIImage) instance that has the calculated statistics attached.

## Discussion

If the image extent is not finite, then nil will be returned.

---

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)