Contents

contentAverageLightLevel

Returns the content average light level of the image.

Declaration

var contentAverageLightLevel: Float { get }

Discussion

If the image average light level is unknown, then the value 0.0 will be returned.

If the image headroom is known, then a value greater than or equal to 0.0 will be returned.

The image average light level may known when a CIImage is first initialized. If the a CIImage is initialized with a:

  • CGImage : then the headroom will be determined by CGImageGetContentAverageLightLevel().

  • CVPixelBuffer : then the headroom will be determined by kCVImageBufferContentLightLevelInfoKey.

If the image is the result of applying a CIFilter or CIKernel, this property will return 0.0.

There are exceptions to this. Applying a CIWarpKernel or certain CIFilter (e.g. CIGaussianBlur, CILanczosScaleTransform, CIAreaAverage and some others) to an image will result in a CIImage instance with the same contentAverageLightLevel property value.