<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 5.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImageGamma_Planar8toPlanarF(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vImageGamma_Planar8toPlanarF"
  },
  "title" : "vImageGamma_Planar8toPlanarF(_:_:_:_:)"
}
-->

# vImageGamma_Planar8toPlanarF(_:_:_:_:)

Applies a gamma function to an 8-bit planar image to produce a 32-bit planar image.

```
func vImageGamma_Planar8toPlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ gamma: GammaFunction!, _ flags: vImage_Flags) -> vImage_Error
```

## Parameters

`src`

The source vImage buffer.

`dest`

A pointer to the destination vImage buffer structure. You’re responsible for filling out the `height`, `width`, and `rowBytes` fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, deallocate the memory to prevent memory leaks.

`gamma`

The gamma function object.

`flags`

The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass [`kvImageDoNotTile`](/documentation/Accelerate/kvImageDoNotTile); otherwise, pass [`kvImageNoFlags`](/documentation/Accelerate/kvImageNoFlags).

## Return Value

[`kvImageNoError`](/documentation/Accelerate/kvImageNoError); otherwise, one of the error codes in <doc://com.apple.documentation/documentation/Accelerate/data-types-and-constants>.

## Discussion

This function maps 8-bit values in the range `0...255` to the floating-point range `0.0...1.0`.

```swift
let source = vImage.PixelBuffer<vImage.Planar8>(
    pixelValues: [  1,
                    3,
                    5,
                   15,
                   17,
                   51 ],
    size: vImage.Size(width: 1, height: 6))

let destination = vImage.PixelBuffer<vImage.PlanarF>(
    size: source.size)

let gamma = vImageCreateGammaFunction(
    1.0,
    Int32(kvImageGamma_UseGammaValue),
    vImage_Flags(kvImageNoFlags))

defer {
    vImageDestroyGammaFunction(gamma)
}

source.withUnsafePointerToVImageBuffer { src in
    destination.withUnsafePointerToVImageBuffer { dest in
        
        _ = vImageGamma_Planar8toPlanarF(
            src,
            dest,
            gamma,
            vImage_Flags(kvImageNoFlags))
        
    }
}

// Prints "[1.0, 3.0, 5.0, 15.0, 17.0, 51.0]".
print(destination.array.map { $0 * 255 })
```

---

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)