---
title: "calculateHDRStats(for:)"
framework: coreimage
role: symbol
role_heading: Instance Method
path: "coreimage/cicontext/calculatehdrstats(for:)-3ia7r"
---

# 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.

## Declaration

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

## Parameters

- `cgimage`: An immutable CGImage for which to calculate statistics.

## Return Value

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