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

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

## Declaration

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

## Parameters

- `image`: An immutable doc://com.apple.coreimage/documentation/CoreImage/CIImage for which to calculate statistics.

## Return Value

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

## Discussion

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