<!--
{
  "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/applyGamma(_:destination:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVA2A06StaticC6FormatRzSf13ComponentTypeRtzrlE10applyGamma_11destinationyAC0J0O_AEy_xGtF"
  },
  "title" : "applyGamma(_:destination:)"
}
-->

# applyGamma(_:destination:)

Applies a gamma function to a 32-bit pixel buffer.

```
func applyGamma(_ gamma: vImage.Gamma, destination: vImage.PixelBuffer<Format>)
```

## Parameters

`gamma`

An enumeration that specifies either a used-defined or constant gamma.

`destination`

The destination pixel buffer.

## Discussion

For example, the following code applies a gamma of `2.0` to a one-pixel pixel buffer:

```swift
let buffer = vImage.PixelBuffer<vImage.PlanarF>(
    pixelValues: [0.5],
    size: vImage.Size(width: 1,
                      height: 1))

buffer.applyGamma(.fullPrecision(2),
                  destination: buffer)

// Prints "[0.25]" = [0.5²].
print(buffer.array)
```

---

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)