camera_android_camerax: Write exposure time to EXIF when missing#11327
camera_android_camerax: Write exposure time to EXIF when missing#11327vodemn wants to merge 1 commit intoflutter:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds a mechanism to write the exposure time to EXIF metadata if it's missing after an image capture. It uses Camera2Interop to attach a SessionCaptureCallback to the ImageCapture use case, which records the SENSOR_EXPOSURE_TIME from the CaptureResult. After the image is saved, the code checks for the existence of TAG_EXPOSURE_TIME in the EXIF data and writes the captured value if it's absent. The implementation includes error handling to avoid failing the capture on EXIF-related issues. Unit tests have been added to verify the new EXIF patching logic under various conditions. I have one suggestion to improve code maintainability.
...a_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureProxyApi.java
Show resolved
Hide resolved
Some devices (e.g. Honor) omit exposure time in JPEG EXIF when using CameraX ImageCapture.takePicture. Use Camera2Interop session capture callback to record SENSOR_EXPOSURE_TIME and patch EXIF after save via ExifInterface when TAG_EXPOSURE_TIME is absent. Adds androidx.exifinterface dependency and unit tests for patchExifExposureTime. Made-with: Cursor
481f171 to
f796925
Compare
|
@vodemn Thank you so much for this fix! I would love to review this and get this fix into the plugin. First, though, can you resolve the missing CLA check? https://github.com/flutter/packages/pull/11327/checks?check_run_id=68072535659 can walk you through it. |
Description
Some devices (e.g. Honor) omit
ExposureTimein JPEG EXIF when using CameraXImageCapture.takePicturewith file output. This mirrors the fix forcamera_android(Camera2) in flutter/packages#11326, but targets the default Android implementation (camera_android_camerax).What changed
Camera2Interop.ExtendersessionCaptureCallbackonImageCaptureto recordCaptureResult.SENSOR_EXPOSURE_TIME.TAG_EXPOSURE_TIMEis missing, write it usingandroidx.exifinterface(nanoseconds → seconds), without failing the capture on EXIF errors.androidx.exifinterface:exifinterface:1.3.7and unit tests inImageCaptureTest.Tests
:camera_android_camerax:testDebugUnitTest --tests io.flutter.plugins.camerax.ImageCaptureTest(from the plugin example afterflutter build apk --config-only).Version
camera_android_cameraxto0.6.25+1and updates CHANGELOG.Made with Cursor