<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/equalizeHistogram(destination:)-939xn",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVA2A013MultiplePlaneC6FormatRzs5UInt8V13ComponentTypeRtzrlE17equalizeHistogram11destinationyAEy_xG_tF"
  },
  "title" : "equalizeHistogram(destination:)"
}
-->

# equalizeHistogram(destination:)

Equalizes the histogram of a multiple-plane 8-bit pixel buffer.

```
func equalizeHistogram(destination: vImage.PixelBuffer<Format>)
```

## Parameters

`destination`

The destination pixel buffer.

## Discussion

Use this function to transform an image so that its histogram is more uniformly distributed across the entire range of values.

For example, the following code equalizes the histogram of an image:

```swift
let srcImage =  imageLiteral(resourceName: " ... ").cgImage(
    forProposedRect: nil,
    context: nil,
    hints: nil)!

var cgImageFormat = vImage_CGImageFormat(
    bitsPerComponent: 8,
    bitsPerPixel: 8 * 3,
    colorSpace: CGColorSpaceCreateDeviceRGB(),
    bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue))!

let interleavedBuffer = try vImage.PixelBuffer(
    cgImage: srcImage,
    cgImageFormat: &cgImageFormat,
    pixelFormat: vImage.Interleaved8x3.self)

let multiplaneBuffer = vImage.PixelBuffer<vImage.Planar8x3>(
    interleavedBuffer: interleavedBuffer)

multiplaneBuffer.equalizeHistogram(destination: multiplaneBuffer)

multiplaneBuffer.convert(to: interleavedBuffer)
```

## See Also

  <doc://com.apple.accelerate/documentation/Accelerate/enhancing-image-contrast-with-histogram-manipulation>



---

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)