<!--
{
  "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:)-3ia7r",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIContext(im)calculateHDRStatsForCGImage:"
  },
  "title" : "calculateHDRStats(for:)"
}
-->

# calculateHDRStats(for:)

Given a Core Graphics 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 Graphics image that has the calculated values.

```
func calculateHDRStats(for cgimage: CGImage) -> CGImage
```

## Parameters

`cgimage`

An immutable `CGImage` for which to calculate statistics.

## Return Value


Returns a new `CGImage` instance that has the calculated statistics attached.

---

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)