<!--
{
  "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/vImageCreateGammaFunction(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vImageCreateGammaFunction"
  },
  "title" : "vImageCreateGammaFunction(_:_:_:)"
}
-->

# vImageCreateGammaFunction(_:_:_:)

Returns a gamma function object.

```
func vImageCreateGammaFunction(_ gamma: Float, _ gamma_type: Int32, _ flags: vImage_Flags) -> GammaFunction!
```

## Parameters

`gamma`

The gamma value when `gamma_type` is [`kvImageGamma_UseGammaValue`](/documentation/Accelerate/kvImageGamma_UseGammaValue) or [`kvImageGamma_UseGammaValue_half_precision`](/documentation/Accelerate/kvImageGamma_UseGammaValue_half_precision).

`gamma_type`

A constant that specifies the gamma type. See <doc://com.apple.documentation/documentation/Accelerate/1584480-gamma-function-types>.

`flags`

Reserved for future use. Pass [`kvImageNoFlags`](/documentation/Accelerate/kvImageNoFlags).

## Return Value

A gamma function object that encapsulates a gamma value, a gamma function type, and option flags.

## Discussion

Use this function to create a gamma function object that you pass to [`vImageGamma_Planar8toPlanarF(_:_:_:_:)`](/documentation/Accelerate/vImageGamma_Planar8toPlanarF(_:_:_:_:)), [`vImageGamma_PlanarFtoPlanar8(_:_:_:_:)`](/documentation/Accelerate/vImageGamma_PlanarFtoPlanar8(_:_:_:_:)), or [`vImageGamma_PlanarF(_:_:_:_:)`](/documentation/Accelerate/vImageGamma_PlanarF(_:_:_:_:)).

The vImage library provides a user-defined half-precision gamma type and constant half-precision gamma types, such as [`kvImageGamma_sRGB_forward_half_precision`](/documentation/Accelerate/kvImageGamma_sRGB_forward_half_precision). Use a half-precision gamma type when creating a gamma function for image data that’s intended for conversion to 8-bit. The half-precision gamma types work with floating-point values in the range `0...1` and provide a precision of ±1 / 4,096.

The gamma correction functions that use a [`GammaFunction`](/documentation/Accelerate/GammaFunction) object are symmetric around zero. That is, they treat negative values as if they’re positive, and restore the sign after applying the exponent.

---

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)