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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-04 UTC.
[null,null,["Last updated 2025-03-04 UTC."],[],[],null,["# Configure for optimization, flash, and file format\n\nThere are a few additional ways you can configure a device's camera with\n`ImageCapture`. You do so with `ImageCapture.Builder` methods.\n| **Note:** For a general overview of how to capture images with CameraX see the [Image capture guide](/media/camera/camerax/take-photo).\n\nSet capture mode\n----------------\n\nUse [`ImageCapture.Builder.setCaptureMode()`](/reference/androidx/camera/core/ImageCapture.Builder#setCaptureMode(int)) to configure the capture mode\nwhen taking a photo:\n\n- [`CAPTURE_MODE_MINIMIZE_LATENCY`](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_MINIMIZE_LATENCY()): optimize image capture for latency.\n- [`CAPTURE_MODE_MAXIMIZE_QUALITY`](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_MAXIMIZE_QUALITY()): optimize image capture for image quality.\n\nThe capture mode defaults to [`CAPTURE_MODE_MINIMIZE_LATENCY`](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_MINIMIZE_LATENCY()). For more\ninformation, see the [`setCaptureMode()`](/reference/androidx/camera/core/ImageCapture.Builder#setCaptureMode(int)) reference documentation.\n| **Note:** There is also an experimental [Zero-Shutter Lag mode](/media/camera/camerax/zsl) available through [`CAPTURE_MODE_ZERO_SHOT_LAG`](/reference/androidx/camera/core/ImageCapture#CAPTURE_MODE_ZERO_SHUTTER_LAG()).\n\nSet flash mode\n--------------\n\nThe default flash mode is [`FLASH_MODE_OFF`](/reference/androidx/camera/core/ImageCapture#FLASH_MODE_OFF()). To set the flash mode, use\n[`ImageCapture.Builder.setFlashMode()`](/reference/androidx/camera/core/ImageCapture.Builder#setFlashMode(int)):\n\n- [`FLASH_MODE_ON`](/reference/androidx/camera/core/ImageCapture#FLASH_MODE_ON()): Flash is always on.\n- [`FLASH_MODE_AUTO`](/reference/androidx/camera/core/ImageCapture#FLASH_MODE_AUTO()): Flash is automatically on for low-light shots.\n\nFile types\n----------\n\nThis workflow demonstrated in this document fully supports the [`JPEG`](/reference/android/graphics/ImageFormat#JPEG)\nformat. For sample code that shows how to convert a [`Media.Image`](/reference/android/media/Image) object\nfrom `YUV_420_888` format to an RGB [`Bitmap`](/reference/android/graphics/Bitmap) object, see\n[`YuvToRgbConverter.kt`](https://github.com/android/camera-samples/blob/3730442b49189f76a1083a98f3acf3f5f09222a3/CameraUtils/lib/src/main/java/com/example/android/camera/utils/YuvToRgbConverter.kt)."]]