---
title: "vImageCreateGammaFunction(_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimagecreategammafunction(_:_:_:)"
---

# vImageCreateGammaFunction(_:_:_:)

Returns a gamma function object.

## Declaration

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

## Parameters

- `gamma`: The gamma value when gamma_type is doc://com.apple.accelerate/documentation/Accelerate/kvImageGamma_UseGammaValue or doc://com.apple.accelerate/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 doc://com.apple.accelerate/documentation/Accelerate/kvImageNoFlags.

## Return Value

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

## Discussion

Discussion Use this function to create a gamma function object that you pass to vImageGamma_Planar8toPlanarF(_:_:_:_:), vImageGamma_PlanarFtoPlanar8(_:_:_:_:), or 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. 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 object are symmetric around zero. That is, they treat negative values as if they’re positive, and restore the sign after applying the exponent.

## See Also

### Applying a gamma function

- [Gamma function types](accelerate/1584480-gamma-function-types.md)
- [vImageGamma_Planar8toPlanarF(_:_:_:_:)](accelerate/vimagegamma_planar8toplanarf(_:_:_:_:).md)
- [vImageGamma_PlanarFtoPlanar8(_:_:_:_:)](accelerate/vimagegamma_planarftoplanar8(_:_:_:_:).md)
- [vImageGamma_PlanarF(_:_:_:_:)](accelerate/vimagegamma_planarf(_:_:_:_:).md)
- [vImageDestroyGammaFunction(_:)](accelerate/vimagedestroygammafunction(_:).md)
- [Adjusting saturation and applying tone mapping](accelerate/adjusting-saturation-and-applying-tone-mapping.md)
