commcare-android icon indicating copy to clipboard operation
commcare-android copied to clipboard

Passthrough Allow-Listed EXIF properties (GPS specifically) with resized images

Open ctsims opened this issue 2 years ago β€’ 2 comments

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.

  1. Create a CCHQ app that captures images.
  2. Install the app on an Android device and capture a photo
  3. Inspect the EXIF data of the saved image to verify that the GPS/Geolocation properties have not been retained.

Possible Solution

  1. Retain GPS/Geolocation Data: Modify the image capture process to retain GPS/Geolocation data from the original image.
  2. 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

ctsims avatar Aug 08 '23 16:08 ctsims

/bounty $150

kiran-tripathy avatar Sep 17 '24 17:09 kiran-tripathy

πŸ’Ž $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

  1. Make sure that you meet the eligibility criteria and have fulfilled all the requirements
  2. 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

  1. Start working: Comment /attempt #2689 with your implementation plan
  2. Submit work: Create a pull request including /claim #2689 in the PR body to claim the bounty
  3. 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

algora-pbc[bot] avatar Sep 17 '24 17:09 algora-pbc[bot]

/attempt #2689

Options

melmathari avatar Nov 24 '24 14:11 melmathari

/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

Image

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..

hashamyounis9 avatar Apr 06 '25 10:04 hashamyounis9

Thanks for your attempt! @shubham1g5 , could you please look into @hashamyounis9's questions?

kiran-tripathy avatar Apr 07 '25 06:04 kiran-tripathy

@hashamyounis9 added the recommended properties in issue description and also commented on the PR you made. Thanks!

shubham1g5 avatar Apr 07 '25 07:04 shubham1g5

πŸŽ‰ The pull request of @hashamyounis9 has been merged. The bounty can be rewarded here

cc @dimagi

algora-pbc[bot] avatar Apr 08 '25 12:04 algora-pbc[bot]

Appreciate your work on this, @hashamyounis9! I’ll get the payment sorted sometime this week.

kiran-tripathy avatar Apr 08 '25 12:04 kiran-tripathy

Thanks @kiran-tripathy @shubham1g5

It was lovely working with you guys, looking forward to future collaborations!

hashamyounis9 avatar Apr 08 '25 13:04 hashamyounis9

πŸŽ‰πŸŽˆ @hashamyounis9 has been awarded $150 by Dimagi, Inc! 🎈🎊

algora-pbc[bot] avatar Apr 09 '25 02:04 algora-pbc[bot]

@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!

kiran-tripathy avatar Apr 09 '25 02:04 kiran-tripathy

This issue has been resolved in #3014, and the fix is now merged. Closing this out!

kiran-tripathy avatar Apr 09 '25 03:04 kiran-tripathy