<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/areaLogarithmicHistogram()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)areaLogarithmicHistogramFilter"
  },
  "title" : "areaLogarithmicHistogram()"
}
-->

# areaLogarithmicHistogram()

Returns a logarithmic histogram of a specified area of the image.

```
class func areaLogarithmicHistogram() -> any CIFilter & CIAreaLogarithmicHistogram
```

## Return Value

A 1-pixel-high image containing the calculated histogram`.`

## Discussion

This filter calculates histograms of the `red,``green,``blue,` and `alpha` colors for the specified area of an image. A base two-logarithm function is applied to the values before binning. The `count` property controls the number of bins (or width) of the histogram. The histogram is scaled so that all the values sum to `scale`.

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `extent`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGRect> that specifies the subregion of the image you want to process.
- `scale`: The scale value for the histogram values. If the scale is `1`, then the bins in the resulting image sum to `1`.
- `count`: The number of bins for the histogram. This value determines the width of the output image. Minimum value `1`, and maximum value `2048`.
- `minimumStop`: The minimum of the range of color channel values in the logarithmic histogram image. Defaults to `-10`.
- `maximumStop`: The maximum of the range of color channel values in the logarithmic histogram image. Defaults to 4.

The following code creates a filter that results in a 1-pixel-tall image with a width of 256. The pixel color components contain the logarithmic histogram values:

```swift
func areaLogarithmicHistogram(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.areaLogarithmicHistogram()
    filter.inputImage = inputImage
    filter.count = 256
    filter.scale = 15
    filter.extent = CGRect(
        x: inputImage.extent.width/2-250,
        y: inputImage.extent.height/2-250,
        width: 500,
        height: 500)
    return filter.outputImage!
}
```

Use the [`histogramDisplay()`](/documentation/CoreImage/CIFilter-swift.class/histogramDisplay()) filter to display the histogram:

```swift
func logarithmicHistogramDisplay(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.histogramDisplay()
    filter.inputImage = areaLogarithmicHistogram(inputImage: inputImage)
    filter.highLimit = 1
    filter.height = 100
    filter.lowLimit = 0
    return filter.outputImage!
}
```

![Two images arranged horizontally. The image on the left contains a photograph of a vineyard. The lower third of the image contains gravel with a deep shadow in the foreground. The middle of the image shows the vineyard receding into the distance. The top of the image shows a partially cloudy sky. The image on the right shows the result of the logarithmic histogram display filter. There are three overlayed charts showing the histogram of the red, green and blue components.](images/com.apple.coreimage/media-4407281@2x.png)

---

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)