---
title: "deviceWhiteBalanceGains(for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturedevice/devicewhitebalancegains(for:)-3wtsa"
---

# deviceWhiteBalanceGains(for:)

Converts device-independent temperature and tint values to device-specific white balance RGB gain values.

## Declaration

```swift
func deviceWhiteBalanceGains(for tempAndTintValues: AVCaptureDevice.WhiteBalanceTemperatureAndTintValues) -> AVCaptureDevice.WhiteBalanceGains
```

## Parameters

- `tempAndTintValues`: An doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/WhiteBalanceTemperatureAndTintValues structure containing the temperature and tint values.

## Return Value

Return Value A fully populated AVCaptureDevice.WhiteBalanceGains structure containing device-specific RGB gain values.

## Discussion

Discussion Call this method to convert device-independent temperature and tint values to device-specific RGB white balance gain values. You may pass any temperature and tint values and corresponding white balance gains will be produced. Note, though, that some temperature and tint combinations yield out-of-range device RGB values that will cause an exception to be thrown if passed directly to setWhiteBalanceModeLocked(with:completionHandler:).  Be sure to verify that the red, green, and blue gain values are within the range of [1.0 - maxWhiteBalanceGain].

## See Also

### Performing conversions

- [chromaticityValues(for:)](avfoundation/avcapturedevice/chromaticityvalues(for:).md)
- [temperatureAndTintValues(for:)](avfoundation/avcapturedevice/temperatureandtintvalues(for:).md)
- [deviceWhiteBalanceGains(for:)](avfoundation/avcapturedevice/devicewhitebalancegains(for:)-9gdtw.md)
- [AVCaptureDevice.WhiteBalanceGains](avfoundation/avcapturedevice/whitebalancegains.md)
- [AVCaptureDevice.WhiteBalanceChromaticityValues](avfoundation/avcapturedevice/whitebalancechromaticityvalues.md)
- [AVCaptureDevice.WhiteBalanceTemperatureAndTintValues](avfoundation/avcapturedevice/whitebalancetemperatureandtintvalues.md)
