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:
CAPTURE_MODE_MINIMIZE_LATENCY
: optimize image capture for latency.CAPTURE_MODE_MAXIMIZE_QUALITY
: optimize image capture for image quality.
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()
:
FLASH_MODE_ON
: Flash is always on.FLASH_MODE_AUTO
: Flash is automatically on for low-light shots.
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
.