Exposure Bias

Adjusting Exposure in a Camera using Exposure Bias Compensation

Exposure Bias allows adjusting the Camera's exposure, where negative values result in darker, under-exposed images, and positive values result in brighter, over-exposed images. A value of 0 indicates no exposure bias compensation, which is the default.

Setting Exposure Bias

To adjust a Camera's exposure via Exposure Bias Compensation:

The <Camera /> view allows adjusting exposure via React state (a number), or a Reanimated SharedValue - which is the recommended approach for smoothly adjusting exposure.

function App() {
  const exposure = useSharedValue(0)

  return (
    <Camera
      style={StyleSheet.absoluteFill}
      isActive={true}
      device="back"
      exposure={exposure}
    />
  )
}

To adjust the Exposure Bias on a CameraController, use setExposureBias(...):

const controller = ...
await controller.setExposureBias(0)

Warning

Make sure your CameraDevice supports exposure (supportsExposureBias), and your exposure value always stays within the CameraDevice's supported exposure bias ranges: minExposureBias and maxExposureBias:

const controller = ...
const exposure = ...
const device = controller.device
if (device.supportsExposureBias) {
  const min = device.minExposureBias
  const max = device.maxExposureBias
  const clampedExposure = clamp(exposure, min, max)
}

Getting Exposure Bias

To get the current Exposure value on a CameraController, use exposureBias:

const controller = ...
console.log(controller.exposureBias) // 0