Passthrough Allow-Listed EXIF properties (GPS specifically) with resized images
Bug Description
The image capture process creates a new copy of the source image without passing through any existing captured EXIF properties. This results in the loss of GPS/Geolocation data and potentially other useful EXIF properties.
Current Behavior
The captured image is saved without retaining any EXIF properties from the original image. While some EXIF properties (e.g., camera details, resolution) may no longer be relevant, important data like GPS/Geolocation is also stripped.
Expected Behavior
Captured images should retain relevant EXIF properties, particularly GPS/Geolocation data. Other common and useful EXIF properties should also be considered for retention.
Reproduction Steps
Note: These steps assume you have basic knowledge of navigating and using the CommCare platform. If you are unfamiliar with how to perform basic setup steps, a getting started guide is available here.
- Create a CCHQ app that captures images.
- Install the app on an Android device and capture a photo
- Inspect the EXIF data of the saved image to verify that the GPS/Geolocation properties have not been retained.
- You can use free online platforms like Ezgif / Metadata2Go to do so.
Possible Solution
- Retain GPS/Geolocation Data: Modify the image capture process to retain GPS/Geolocation data from the original image.
- Review and Retain Other EXIF Properties: Conduct a review to identify other common and useful EXIF properties that should be retained. These may include, but are not limited to, date/time, orientation, and possibly other metadata that users may find useful.
Additional Information/Context
Keep in mind that it may not be possible to replicate the issue on all devices.
Environment details (OS name and version, etc.)
No response
/bounty $150
π $150 bounty β’ Dimagi, Inc
This issue is eligible for rewards from CommCare's Open Source Bounty Program.
Contribution Prerequisites
Before you proceed, please read through the details of the CommCare Bounty Program
- Make sure that you meet the eligibility criteria and have fulfilled all the requirements
- We recommend creating appropriate accounts and signing the CLA ahead of time if you are planning on pursuing a bounty for your open source contribution
Steps to solve
-
Start working: Comment
/attempt #2689with your implementation plan -
Submit work: Create a pull request including
/claim #2689in the PR body to claim the bounty - Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts
Thank you for contributing to dimagi/commcare-android!
Add a bounty β’ Share on socials
| Attempt | Started (UTC) | Solution | Actions |
|---|---|---|---|
| π’ @hashamyounis9 | Apr 06, 2025, 10:56:33 AM | #3014 | Reward |
| π’ @melmathari | Nov 24, 2024, 02:41:35 PM | WIP |
/attempt #2689
@ctsims @kiran-tripathy here is the proposed solution(actually implemented already on local fork):
I wrote a method copyExifData() which copies the EXIF properties from the original image to the scaled image before returning the scaled image, I'm retaining the following EXIF properties:
ExifInterface.TAG_DATETIME
ExifInterface.TAG_MAKE
ExifInterface.TAG_MODEL
ExifInterface.TAG_ORIENTATION
ExifInterface.TAG_GPS_LATITUDE
ExifInterface.TAG_GPS_LONGITUDE
ExifInterface.TAG_GPS_LATITUDE_REF
ExifInterface.TAG_GPS_LONGITUDE_REF
ExifInterface.TAG_FLASH
ExifInterface.TAG_EXPOSURE_TIME
as can be seen in the following screenshot from the logs of the app on my machine
in the above screenshot of the logs of the app are structured in the way that value on the left side of -> coming from the original image and the value on the right side is coming from the scaled image.
I would like to confirm if the properties I am retaining are enough or if there are some other properties that we want to retain from the original image to the scaled one.
Also should the logger function whose output is shown in above screenshot be removed or kept as it is?
Opened the PR #3014
let me know of any changes required..
Thanks for your attempt! @shubham1g5 , could you please look into @hashamyounis9's questions?
@hashamyounis9 added the recommended properties in issue description and also commented on the PR you made. Thanks!
Appreciate your work on this, @hashamyounis9! Iβll get the payment sorted sometime this week.
Thanks @kiran-tripathy @shubham1g5
It was lovely working with you guys, looking forward to future collaborations!
ππ @hashamyounis9 has been awarded $150 by Dimagi, Inc! ππ
@hashamyounis I've processed the payment from my end. You should receive it within 2β5 business days, assuming all your payment details are set up correctly on Algora. Let me know if you donβt see it after that timeframe!
This issue has been resolved in #3014, and the fix is now merged. Closing this out!