{"id":266980,"date":"2024-12-18T15:58:54","date_gmt":"2024-12-18T15:58:54","guid":{"rendered":"https:\/\/michigandigitalnews.com\/index.php\/2024\/12\/18\/how-instagram-enabled-users-to-take-stunning-low-light-photos\/"},"modified":"2025-06-25T17:10:00","modified_gmt":"2025-06-25T17:10:00","slug":"how-instagram-enabled-users-to-take-stunning-low-light-photos","status":"publish","type":"post","link":"https:\/\/michigandigitalnews.com\/index.php\/2024\/12\/18\/how-instagram-enabled-users-to-take-stunning-low-light-photos\/","title":{"rendered":"How Instagram enabled users to take stunning Low Light Photos"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div>\n<meta content=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEheCE-0uLP7rrtb5MLiPKZnZt8TOsGXzHrvG48Jfgmi_B7oVmXPtFA_0iADgxpUic7LnW4nVp2OksYTIbL2vexv0FwRU_1RgSxZpvgx0xrrEMCzRff37bM1mslPjllsvjMtt920kZlFMUtOnk4UxOAJDvENCCJhOuzvet-0aS0jJnH25hBlGydGJmvH7gc\/s1600\/Instagram-Low-Light-Case-Study-Metadata-Card%20%283%29.gif\" name=\"twitter:image\"\/><br \/>\n<img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEheCE-0uLP7rrtb5MLiPKZnZt8TOsGXzHrvG48Jfgmi_B7oVmXPtFA_0iADgxpUic7LnW4nVp2OksYTIbL2vexv0FwRU_1RgSxZpvgx0xrrEMCzRff37bM1mslPjllsvjMtt920kZlFMUtOnk4UxOAJDvENCCJhOuzvet-0aS0jJnH25hBlGydGJmvH7gc\/s1600\/Instagram-Low-Light-Case-Study-Metadata-Card%20%283%29.gif\" style=\"display: none;\"\/><\/p>\n<p><em>Posted by Donovan McMurray \u2013 Developer Relations Engineer<\/em><\/p>\n<p><a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEheCE-0uLP7rrtb5MLiPKZnZt8TOsGXzHrvG48Jfgmi_B7oVmXPtFA_0iADgxpUic7LnW4nVp2OksYTIbL2vexv0FwRU_1RgSxZpvgx0xrrEMCzRff37bM1mslPjllsvjMtt920kZlFMUtOnk4UxOAJDvENCCJhOuzvet-0aS0jJnH25hBlGydGJmvH7gc\/s1600\/Instagram-Low-Light-Case-Study-Metadata-Card%20%283%29.gif\"><img decoding=\"async\" border=\"0\" data-original-height=\"800\" data-original-width=\"100%\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEheCE-0uLP7rrtb5MLiPKZnZt8TOsGXzHrvG48Jfgmi_B7oVmXPtFA_0iADgxpUic7LnW4nVp2OksYTIbL2vexv0FwRU_1RgSxZpvgx0xrrEMCzRff37bM1mslPjllsvjMtt920kZlFMUtOnk4UxOAJDvENCCJhOuzvet-0aS0jJnH25hBlGydGJmvH7gc\/s1600\/Instagram-Low-Light-Case-Study-Metadata-Card%20%283%29.gif\"\/><\/a><\/p>\n<p>Instagram, the popular photo and video sharing social networking service, is constantly delighting users with a best-in-class camera experience. Recently, Instagram launched another improvement on Android with their Night Mode implementation.<\/p>\n<p>As devices and their cameras become more and more capable, users expect better quality images in a wider variety of settings. Whether it\u2019s a night out with friends or the calmness right after you get your baby to fall asleep, the special moments users want to capture often don\u2019t have ideal lighting conditions.<\/p>\n<p>Now, when Instagram users on Android take a photo in low light environments, they\u2019ll see a moon icon that allows them to activate Night Mode for better image quality. This feature is currently available to users with any Pixel device from the 6 series and up, a Samsung Galaxy S24Ultra, or a Samsung Flip6 or Fold6, with more devices to follow.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"Moving image showing the user experience of taking a photo of a shelf with plants, oranges, and decorative items in low light\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiPIgn78UZMSoaSSlRLQdZNRQNxUggrB2l66akuFGajtcxJidF-4Au2FEUiJcK8JEAjm4C0fKRXLdJS0YS4wysY6qOfjkDW8x4Fpfld2d1PMHeEPygMvDqQzjuvZ1E9N4ur8HpWck2PMBK05P0r7X7Q5mdxjh7EOfnK9TFEsL4ELeEzx62zkNM68qLpfbg\/s1600\/Instagram-Low-Light-Demo.gif\" width=\"30%\"\/><\/div>\n<p><\/image><\/p>\n<h3>Leveraging Device-specific Camera Technologies<\/h3>\n<p>Android enables apps to take advantage of device-specific camera features through the <a href=\"https:\/\/developer.android.com\/media\/camera\/camera-extensions\" target=\"_blank\" rel=\"noopener\">Camera Extensions API<\/a>. The Extensions framework currently provides functionality like Night Mode for low-light image captures, Bokeh for applying portrait-style background blur, and Face Retouch for beauty filters. All of these features are implemented by the Original Equipment Manufacturers (OEMs) in order to maximize the quality of each feature on the hardware it&#8217;s running on.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"A quote by Nilesh Patel, Software Engineer, reads: 'For Meta's billions of users, having to write custom code for each new device is simply not scalable. It would also add unnecessary app size when Meta users download the app. Hence our guideline is \u2018write once to scale to billions\u2019, favoring platform APIs.' A headshot of Nilesh Patel is displayed to the right of the quote card.\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiT8KtpJKEQ0xQMWNiUVPpuKFlQAMwC8Rppf-gX8k-uyZp9zMrO6fqQOnRwNjAsLJHOwPMOLVSOrDwqaY-B_aWvLBzXqEd9JR0mHcame8uSNCx8Ciox_FMYtiKK95cKGG7g4fz_kavWmeSCC4k3W3a13VIQk1CIr6nnW_Md_26Pt6gF3fnReRmXcKnwK6M\/s1600\/Instagram-Low-Light-Case-Study-Quote-Card-1.png\" width=\"100%\"\/><\/div>\n<p><\/image><\/p>\n<p>Furthermore, exposing this OEM-specific functionality through the Extensions API allows developers to use a consistent implementation across all of these devices, getting the best of both worlds: implementations that are tuned to a wide-range of devices with a unified API surface. According to Nilesh Patel, a Software Engineer at Instagram, \u201cfor Meta\u2019s billions of users, having to write custom code for each new device is simply not scalable. It would also  add unnecessary app size when Meta users download the app. Hence our guideline is \u2018write once to scale to billions\u2019, favoring platform APIs.\u201d <\/p>\n<p>More and more OEMs are supporting Extensions, too! There are already over 120 different devices that support the Camera Extensions, representing over 75 million monthly active users. There\u2019s never been a better time to integrate Extensions into your Android app to give your users the best possible camera experience.<\/p>\n<h3>Impact on Instagram<\/h3>\n<p>The results of adding Night Mode to Instagram have been very positive for Instagram users. Jin Cui, a Partner Engineer on Instagram, said \u201cNight Mode has increased the number of photos captured and shared with the Instagram camera, since the quality of the photos are now visibly better in low-light scenes.\u201d<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"A quote from Jin Cui, Partner Engineer, reads: 'Night Mode has increased the number of photos captured and shared with the Instagram camera, since the quality of the photos are now visibly better in low-light scenes.'  A photo of Jin Cui wearing glasses and a maroon hoodie is shown to the right of the quote card.\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgC2WJUHy2T1phGfcCCvNMoO6Yy2izhbiXYkAyTwMY5crZGsjzqX125cbpSmrV5kQIZn3EbPi5RX2KC7Fb8hQ8ShyphenhyphenwIcCNeMbxw3Ctv5SsHwhWDzncoNvUeIlbndXAik-jPaNfr3B1doS4fO41Y6dShA8IOShT58qUeHtJxCojVSBAPT5ytUQYHo6_tItg\/s1600\/4.png\" width=\"100%\"\/><\/div>\n<p><\/image><\/p>\n<p>Compare the following photos to see just how big of a difference Night Mode makes. The first photo is taken in Instagram with Night Mode off, the second photo is taken in Instagram with Night Mode on, and the third photo is taken with the native camera app with the device\u2019s own low-light processing enabled.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"A 3x3 grid of photos compares low-light performance across different smartphone cameras and Instagram's night mode. The photos show a shelf with plants, oranges, and decorative items, taken with a Pixel 9 Pro, Samsung Galaxy S24 Ultra, and Pixel 6 Pro, both with and without night mode enabled.\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgfOOL7Tfk9qRc81bCdC5qMgfnJhfzsgeBCD4Bqv4rvVuhc5A3tiYkVh5LB5CjLeWXBpqYMr13sdYTwWGgY_dPfRDfAW4sQbLzDeb3umNi7eNxh4LNqhn2D0JaS59ykjg27Xwb2sJNZ4SmAeJ5c-EhLEXiLg1DGKKfb73jNXrpNX_fKzCArTbqpNeGLTJQ\/s1600\/Instagram%20Night%20Mode%20Comparison.png\" width=\"100%\"\/><\/div>\n<p><\/image><\/p>\n<h3>Ensuring Quality through Image Test Suite (ITS)<\/h3>\n<p><a href=\"https:\/\/source.android.com\/docs\/compatibility\/cts\/camera-its\" target=\"_blank\" rel=\"noopener\">The Android Camera Image Test Suite<\/a> (ITS) is a framework for testing images from Android cameras. ITS tests configure the camera and capture shots to verify expected image data. These tests are functional and ensure advertised camera features work as expected. A tablet mounted on one side of the ITS box displays the test chart. The device under test is mounted on the opposite side of the ITS box.<\/p>\n<p>Devices must pass the ITS tests for any feature that the device claims to support for apps to use, including the tests we have for the Night Mode Camera Extension.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"Regular field-of-view (RFoV) ITS box Rev1b showing the device mounting brackets\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiYrN8a7DawBfJ_u_x5QEoNNX3v0PSkuuqO3ridSEP0cIezmqPuy3GujLdomTBwUvK5l1mN6GDFcdSpCrv57B5VyDJCWge3RwIy70jMWgDYjpmg6h9b194hnHodGAlyDaotHj6_rNETJ1IkkQUO4fbR0nL40ViEea0riwwDKukkTZ3Gc0XoAl7WG7t2BKw\/s1600\/image13.png\" width=\"640\"\/><\/div>\n<p><imgcaption><center><em>Regular field-of-view (RFoV) ITS box Rev1b showing the device mounting brackets<\/em><\/center><\/imgcaption><\/image><\/p>\n<p>The Android Camera team faced the challenge of ensuring the Night Mode Camera Extension feature functioned consistently across all devices in a scalable way. This required creating a testing environment with very low light and a wide dynamic range. This configuration was necessary to simulate real-world lighting scenarios, such as a city at night with varying levels of brightness and shadow, or the atmospheric lighting of a restaurant.<\/p>\n<p>The first step to designing the test was to define the specific lighting conditions to simulate. Field testing with a light meter in various locations and lighting conditions was conducted to determine the target lux level. The goal was to ensure the camera could capture clear images in low-light conditions, which led to the establishment of 3 lux as the target lux level. The figure below shows various lighting conditions and their respective lux value.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"Evaluation of scenes of varying lighting conditions measured with a Light Meter\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEidtH_-2D4zzXah4wnDrZAW406wnS8Ac8hlQithcGYpsIAOGlWs604NDu-0nluh7Zn1bxJPnZaRirgh37psXsKsz7IwfYN9KZ9LT0uzC5jPRbf06kaUTuCtJJ5e_b4qizgIcNZPy71vYYVx9KZb5dpanIZXCY2Ru8sqYD-FZIKLP3j_mKVAz6mFwcKo2E0\/s1600\/image9.png\" width=\"640\"\/><\/div>\n<p><imgcaption><center><em>Evaluation of scenes of varying lighting conditions measured with a Light Meter<\/em><\/center><\/imgcaption><\/image><\/p>\n<p>The next step was to develop a test chart to accurately measure a wide dynamic range in a low light environment. The team developed and iterated on several test charts and arrived at the following test chart shown below. This chart arranges a grid of squares in varying shades of grey. A red outline defines the test area for cropping. This enables excluding darker external regions. The grid follows a Hilbert curve pattern to minimize abrupt light or dark transitions. The design allows for both quantitative measurements and simulation of a broad range of light conditions.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"Low Light test chart displayed on tablet in ITS box\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEib1phXLthNeF7L-1MUZ_EHCma6UDvtRXAhw37ppuQhFG4TurjiEGT2N96Xo9yhDDZhTx9a6OYuXD-sTTcY17WSJx-IRrAI0D-EtFcepkbo_bQ7pTEI8R0ELh-eb4vpaRHl9yxLMtJaVUB3dvgtEKK_eAo6Vw8-KvHzIJjjgDfBUYnyMMw68UnqfwkdS7c\/s1600\/image4.png\" width=\"640\"\/><\/div>\n<p><imgcaption><center><em>Low Light test chart displayed on tablet in ITS box<\/em><\/center><\/imgcaption><\/image><\/p>\n<p>The test chart captures an image using the Night Mode Camera Extension in low light conditions. The image is used to evaluate the improvement in the shadows and midtones while ensuring the highlights aren\u2019t saturated. This evaluation involves two criteria: ensure the average luma value of the six darkest boxes is at least 85, and ensure the average luma contrast between these boxes is at least 17. The figure below shows the test capture and chart results.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"Night Mode Camera Extension capture and test chart result\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEg4fLXpVROXRKXc77yYlluhzWq4FpHvMH2xMgZ51YQfjK1k000Mp4i4qpH-bWc-Fon8ob-BUqIf3bYafP5ej29MdVrrXBlB2iANpl5m__Uw6b1ZypOmpIDyovanqImUlIkHWqMl7Ump659e9gzrnC-AQ8m0bATiKdDItYFGAh8ptlTDqpWPcXBn2IQikoI\/s1600\/image6.png\" width=\"640\"\/><\/div>\n<p><imgcaption><center><em>Night Mode Camera Extension capture and test chart result<\/em><\/center><\/imgcaption><\/image><\/p>\n<p>By leveraging the existing ITS infrastructure, the Android Camera team was able to provide consistent, high quality Night Mode Camera Extension captures. This gives application developers the confidence to integrate and enable Night Mode captures for their users. It also allows OEMs to validate their implementations and ensure users get the best quality capture.<\/p>\n<h3>How to Implement Night Mode with Camera Extensions<\/h3>\n<p>Camera Extensions are available to apps built with Camera2 or CameraX. In this section, we\u2019ll walk through each of the features Instagram implemented. The code examples will use CameraX, but you\u2019ll find links to the Camera2 documentation at each step.<\/p>\n<h4><span style=\"font-size:large;\">Enabling Night Mode Extension<\/span><\/h4>\n<p>Night Mode involves combining multiple exposures into a single still photo for better quality shots in low-light environments. So first, you\u2019ll need to check for Night Mode availability, and tell the camera system to start a Camera Extension session. With CameraX, this is done with an <span style=\"font-family: Courier;\"><a href=\"https:\/\/developer.android.com\/reference\/androidx\/camera\/extensions\/ExtensionsManager\" target=\"_blank\" rel=\"noopener\">ExtensionsManager<\/a><\/span> instead of the standard <span style=\"font-family: Courier;\"><a href=\"https:\/\/developer.android.com\/reference\/android\/hardware\/camera2\/CameraManager\" target=\"_blank\" rel=\"noopener\">CameraManager<\/a><\/span>.<\/p>\n<div style=\"background: rgb(248, 248, 248); border: 0px; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"color: green; font-weight: bold;\">private<\/span> suspend <span style=\"color: green; font-weight: bold;\">fun<\/span> <span style=\"color: blue;\">setUpCamera<\/span>() {\n  <span style=\"color: #408080; font-style: italic;\">\/\/ Obtain an instance of a process camera provider. The camera provider<\/span>\n  <span style=\"color: #408080; font-style: italic;\">\/\/ provides access to the set of cameras associated with the device.<\/span>\n  <span style=\"color: #408080; font-style: italic;\">\/\/ The camera obtained from the provider will be bound to the activity lifecycle.<\/span>\n  <span style=\"color: green; font-weight: bold;\">val<\/span> cameraProvider = ProcessCameraProvider.getInstance(application).await()\n\n  <span style=\"color: #408080; font-style: italic;\">\/\/ Obtain an instance of the extensions manager. The extensions manager <\/span>\n  <span style=\"color: #408080; font-style: italic;\">\/\/ enables a camera to use extension capabilities available on the device.<\/span>\n  <span style=\"color: green; font-weight: bold;\">val<\/span> extensionsManager = ExtensionsManager.getInstanceAsync(\n    application, cameraProvider).await()\n\n  <span style=\"color: #408080; font-style: italic;\">\/\/ Select the camera.<\/span>\n  <span style=\"color: green; font-weight: bold;\">val<\/span> cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA\n\n  <span style=\"color: #408080; font-style: italic;\">\/\/ Query if extension is available. Not all devices will support <\/span>\n  <span style=\"color: #408080; font-style: italic;\">\/\/ extensions or might only support a subset of extensions.<\/span>\n  <span style=\"color: green; font-weight: bold;\">if<\/span> (extensionsManager.isExtensionAvailable(cameraSelector, ExtensionMode.NIGHT)) {\n    <span style=\"color: #408080; font-style: italic;\">\/\/ Unbind all use cases before enabling different extension modes.<\/span>\n    <span style=\"color: green; font-weight: bold;\">try<\/span> {\n      cameraProvider.unbindAll()\n\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Retrieve a night extension enabled camera selector<\/span>\n      <span style=\"color: green; font-weight: bold;\">val<\/span> nightCameraSelector = extensionsManager.getExtensionEnabledCameraSelector(\n        cameraSelector,\n        ExtensionMode.NIGHT\n      )\n\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Bind image capture and preview use cases with the extension enabled camera<\/span>\n      <span style=\"color: #408080; font-style: italic;\">\/\/ selector.<\/span>\n      <span style=\"color: green; font-weight: bold;\">val<\/span> imageCapture = ImageCapture.Builder().build()\n      <span style=\"color: green; font-weight: bold;\">val<\/span> preview = Preview.Builder().build()\n        \n      <span style=\"color: #408080; font-style: italic;\">\/\/ Connect the preview to receive the surface the camera outputs the frames<\/span>\n      <span style=\"color: #408080; font-style: italic;\">\/\/ to. This will allow displaying the camera frames in either a TextureView<\/span>\n      <span style=\"color: #408080; font-style: italic;\">\/\/ or SurfaceView. The SurfaceProvider can be obtained from the PreviewView.<\/span>\n      preview.setSurfaceProvider(surfaceProvider)\n\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Returns an instance of the camera bound to the lifecycle<\/span>\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Use this camera object to control various operations with the camera<\/span>\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Example: flash, zoom, focus metering etc.<\/span>\n      <span style=\"color: green; font-weight: bold;\">val<\/span> camera = cameraProvider.bindToLifecycle(\n        lifecycleOwner,\n        nightCameraSelector,\n        imageCapture,\n        preview\n      )\n    } <span style=\"color: green; font-weight: bold;\">catch<\/span> (e: Exception) {\n      Log.e(TAG, <span style=\"color: #ba2121;\">\"Use case binding failed\"<\/span>, e)\n    }\n  } <span style=\"color: green; font-weight: bold;\">else<\/span> {\n    <span style=\"color: #408080; font-style: italic;\">\/\/ In the case where the extension isn't available, you should set up<\/span>\n    <span style=\"color: #408080; font-style: italic;\">\/\/ CameraX normally with non-extension-enabled CameraSelector.<\/span>\n  }\n}\n<\/pre>\n<\/div>\n<p>To do this in Camera2, see the <a href=\"https:\/\/developer.android.com\/media\/camera\/camera2\/extensions-api#create_a_cameraextensionsession_with_the_camera2_extensions_api\" target=\"_blank\" rel=\"noopener\">Create a <span style=\"font-family: Courier;\">CameraExtensionSession<\/span> with the Camera2 Extensions API<\/a> guide.<\/p>\n<h4><span style=\"font-size:large;\">Implementing the Progress Bar and PostView Image<\/span><\/h4>\n<p>For an even more elevated user experience, you can provide feedback while the Night Mode capture is processing. In Android 14, we added callbacks for the progress and for post view, which is a temporary image capture before the Night Mode processing is complete. The below code shows how to use these callbacks in the <span style=\"font-family: Courier;\"><a href=\"https:\/\/developer.android.com\/reference\/androidx\/camera\/core\/ImageCapture#%28androidx.camera.core.ImageCapture%29.takePicture%28androidx.camera.core.ImageCapture.OutputFileOptions,kotlin.Function0,kotlin.Function1,kotlin.Function1%29\" target=\"_blank\" rel=\"noopener\">takePicture()<\/a><\/span> method. The actual implementation to update the UI is very app-dependent, so we\u2019ll leave the actual UI updating code to you.<\/p>\n<div style=\"background: rgb(248, 248, 248); border: 0px; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"color: #408080; font-style: italic;\">\/\/ When setting up the ImageCapture.Builder, set postviewEnabled and <\/span>\n<span style=\"color: #408080; font-style: italic;\">\/\/ posviewResolutionSelector in order to get a PostView bitmap in the<\/span>\n<span style=\"color: #408080; font-style: italic;\">\/\/ onPostviewBitmapAvailable callback when takePicture() is called.<\/span>\n<span style=\"color: green; font-weight: bold;\">val<\/span> cameraInfo = cameraProvider.getCameraInfo(cameraSelector)\n<span style=\"color: green; font-weight: bold;\">val<\/span> isPostviewSupported =\n  ImageCapture.getImageCaptureCapabilities(cameraInfo).isPostviewSupported\n\n<span style=\"color: green; font-weight: bold;\">val<\/span> postviewResolutionSelector = ResolutionSelector.Builder()\n  .setAspectRatioStrategy(AspectRatioStrategy(\n    AspectRatioStrategy.RATIO_16_9_FALLBACK_AUTO_STRATEGY, \n    AspectRatioStrategy.FALLBACK_RULE_AUTO))\n  .setResolutionStrategy(ResolutionStrategy(\n    previewSize, \n    ResolutionStrategy.FALLBACK_RULE_CLOSEST_LOWER_THEN_HIGHER\n  ))\n  .build()\n\nimageCapture = ImageCapture.Builder()\n  .setTargetAspectRatio(AspectRatio.RATIO_16_9)\n  .setPostviewEnabled(isPostviewSupported)\n  .setPostviewResolutionSelector(postviewResolutionSelector)\n  .build()\n\n<span style=\"color: #408080; font-style: italic;\">\/\/ When the Night Mode photo is being taken, define these additional callbacks<\/span>\n<span style=\"color: #408080; font-style: italic;\">\/\/ to implement PostView and a progress indicator in your app.<\/span>\nimageCapture.takePicture(\n  outputFileOptions,\n  Dispatchers.Default.asExecutor(),\n  object : ImageCapture.OnImageSavedCallback {\n    <span style=\"color: green; font-weight: bold;\">override<\/span> <span style=\"color: green; font-weight: bold;\">fun<\/span> <span style=\"color: blue;\">onPostviewBitmapAvailable<\/span>(bitmap: Bitmap) {\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Add the Bitmap to your UI as a placeholder while the final result is processed<\/span>\n    }\n\n    <span style=\"color: green; font-weight: bold;\">override<\/span> <span style=\"color: green; font-weight: bold;\">fun<\/span> <span style=\"color: blue;\">onCaptureProcessProgressed<\/span>(progress: Int) {\n      <span style=\"color: #408080; font-style: italic;\">\/\/ Use the progress value to update your UI; values go from 0 to 100.<\/span>\n    }\n  }\n)\n<\/pre>\n<\/div>\n<p>To accomplish this in Camera2, see the <a href=\"https:\/\/github.com\/android\/camera-samples\/blob\/main\/Camera2Extensions\/app\/src\/main\/java\/com\/example\/android\/camera2\/extensions\/fragments\/CameraFragment.kt\" target=\"_blank\" rel=\"noopener\">CameraFragment.kt<\/a> file in the Camera2Extensions sample app.<\/p>\n<h4><span style=\"font-size:large;\">Implementing the Moon Icon Indicator<\/span><\/h4>\n<p>Another user-focused design touch is showing the moon icon to let the user know that a Night Mode capture will happen. It\u2019s also a good idea to let the user tap the moon icon to disable Night Mode capture. There\u2019s an upcoming API in Android 16 next year to let you know when the device is in a low-light environment.<\/p>\n<p>Here are the possible values for the Night Mode Indicator API:<\/p>\n<ul>\n<ul>\n<p><b>UNKNOWN<\/b><\/p>\n<ul>\n<li>The camera is unable to reliably detect the lighting conditions of the current scene to determine if a photo will benefit from a Night Mode Camera Extension capture.<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p><\/p>\n<ul>\n<ul>\n<p><b>OFF<\/b><\/p>\n<ul>\n<li>The camera has detected lighting conditions that are sufficiently bright. Night Mode Camera Extension is available but may not be able to optimize the camera settings to take a higher quality photo.<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p><\/p>\n<ul>\n<ul>\n<p><b>ON<\/b><\/p>\n<ul>\n<li>The camera has detected low-light conditions. It is recommended to use Night Mode Camera Extension to optimize the camera settings to take a high-quality photo in the dark.<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<h3>Next Steps<\/h3>\n<p>Read more about Android\u2019s camera APIs in the <a href=\"https:\/\/developer.android.com\/media\/camera\/camera2\" target=\"_blank\" rel=\"noopener\">Camera2 guides<\/a> and the <a href=\"https:\/\/developer.android.com\/media\/camera\/camerax\" target=\"_blank\" rel=\"noopener\">CameraX guides<\/a>. Once you\u2019ve got the basics down, check out the <a href=\"https:\/\/developer.android.com\/media\" target=\"_blank\" rel=\"noopener\">Android Camera and Media Dev Center<\/a> to take your camera app development to the next level. For more details on upcoming Android features, like the Night Mode Indicator API, get started with the <a href=\"https:\/\/developer.android.com\/about\/versions\/16\/overview\" target=\"_blank\" rel=\"noopener\">Android 16 Preview<\/a> program.<\/p>\n<\/div>\n<p>[ad_2]<br \/>\n<br \/><a href=\"http:\/\/android-developers.googleblog.com\/2024\/12\/instagram-on-android-low-light-photos.html\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Posted by Donovan McMurray \u2013 Developer Relations Engineer Instagram, the popular photo and video sharing social networking service, is constantly delighting users with a<\/p>\n","protected":false},"author":1,"featured_media":266981,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[146],"tags":[],"_links":{"self":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/266980"}],"collection":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/comments?post=266980"}],"version-history":[{"count":0,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/266980\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media\/266981"}],"wp:attachment":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media?parent=266980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/categories?post=266980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/tags?post=266980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}