Configure for optimization, flash, and file format

There are a few additional ways you can configure a device's camera with ImageCapture. You do so with ImageCapture.Builder methods.

Set capture mode

Use ImageCapture.Builder.setCaptureMode() to configure the capture mode when taking a photo:

The capture mode defaults to CAPTURE_MODE_MINIMIZE_LATENCY. For more information, see the setCaptureMode() reference documentation.

Set flash mode

The default flash mode is FLASH_MODE_OFF. To set the flash mode, use ImageCapture.Builder.setFlashMode():

File types

This workflow demonstrated in this document fully supports the JPEG format. For sample code that shows how to convert a Media.Image object from YUV_420_888 format to an RGB Bitmap object, see YuvToRgbConverter.kt.