dimagi / commcare-android

Offline First Android software client for CommCare, the world's largest platform for designing, managing, and deploying robust mobile applications to frontline workers worldwide
https://www.dimagi.com/open-source/
Apache License 2.0
37 stars 25 forks source link

Respect image orientation during resizing #2743

Open ctsims opened 6 months ago

ctsims commented 6 months ago

Bug Description

When image resizing is applied to captured images, EXIF data is currently getting stripped.

Current Behavior

Since most Android cameras do not natively rotate the pixels in a photo but instead set the orientation in EXIF data, resized images do not display in the same orientation as the original captured photo

Expected Behavior

Resized images should maintain the correct orientation as the original captured photo.

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. Open the camera app and take a picture
    • Check and note the image’s EXIF orientation data. You can use free online platforms like Ezgif / Metadata2Go to do so.
  3. Install the app on an Android device
  4. When you get to a screen with an image capture question, capture the photo by choosing the above photo you clicked from your phone.
  5. After form submission, navigate to Submit History report on HQ and download the attachment
    • Check the resized image’s EXIF orientation data
  6. Observe that the resized image on HQ does not include the orientation data of the original captured photo.

Possible Solution

Passing through some EXIF information during the resizing process or reading.

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 commented 6 months ago

Other EXIF respect use case: https://github.com/dimagi/commcare-android/issues/2689