Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Wrong iOS photo exif data #2209

Open
1 of 3 tasks
sakonn opened this issue Oct 9, 2024 · 1 comment
Open
1 of 3 tasks

[Bug]: Wrong iOS photo exif data #2209

sakonn opened this issue Oct 9, 2024 · 1 comment

Comments

@sakonn
Copy link

sakonn commented Oct 9, 2024

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2
@capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 5.5.1
@capacitor/android: 5.5.1
@capacitor/ios: 5.5.1

[success] iOS looking great! 👌
[success] Android looking great! 👌

Other API Details

npm version: 10.8.2
node version: v20.17.0
pod version: 1.13.0
iOS version: 17.4.1
ios device: iPhone SE 2nd generation

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I am developing a data collection app where data is collected primarily in the form of photos which are later processed. To make postprocessing more straightforward it is required that they are taken in portrait mode (not in landscape). So, I am trying to figure out a way to restrict taking pictures which are landscape-oriented. I have not found any suitable setting for that, so now I am trying to disable saving photos that are wider than higher (landscape by this logic) based on the photo metadata. Photos are taken by the capacitor camera plugin when taking the photos I have found out that information about the photos taken in the iOS app is incorrect.

Portrait photo taken in the ios app:
20241009-080808_4780201379629_overviewImage

And the related exif metadata about this photo which are returned by the plugin:

{
    "Flash": 16,
    "SubsecTimeOriginal": "675",
    "PixelXDimension": 4032,
    "MeteringMode": 5,
    "ApertureValue": 1.6959938131099002,
    "BrightnessValue": -3.0617721648310905,
    "ColorSpace": 65535,
    "FocalLenIn35mmFilm": 28,
    "SceneType": 1,
    "ExposureBiasValue": 0,
    "PixelYDimension": 3024,
    "Orientation": 1,
    "ExposureTime": 0.06666666666666667,
    "CompositeImage": 2,
    "ExposureProgram": 2,
    "WhiteBalance": 0,
    "ShutterSpeedValue": 3.9085506496196545,
    "LensModel": "iPhone SE (2nd generation) back camera 3.99mm f/1.8",
    "ExifVersion": "0232",
    "ISOSpeedRatings": [
      800
    ],
    "LensSpecification": [
      3.99,
      3.99,
      1.8,
      1.8
    ],
    "LensMake": "Apple",
    "SensingMethod": 2,
    "DateTimeDigitized": "2024:10:09 08:08:04",
    "ExposureMode": 0,
    "FNumber": 1.8,
    "DateTimeOriginal": "2024:10:09 08:08:04",
    "FocalLength": 3.99,
    "SubsecTimeDigitized": "675",
    "OffsetTimeOriginal": "+02:00",
    "SubjectArea": [
      2013,
      1511,
      2116,
      1330
    ],
    "OffsetTimeDigitized": "+02:00",
    "OffsetTime": "+02:00"
  },

Landscape photo taken in the ios app:
20241009-080905_4780201379629_facingImage

And the related exif metadata about this photo which are returned by the plugin:

{
    "Flash": 16,
    "SubsecTimeOriginal": "524",
    "PixelXDimension": 4032,
    "MeteringMode": 5,
    "ApertureValue": 1.6959938131099002,
    "BrightnessValue": -3.343055762488874,
    "ColorSpace": 65535,
    "FocalLenIn35mmFilm": 28,
    "SceneType": 1,
    "ExposureBiasValue": 0,
    "PixelYDimension": 3024,
    "Orientation": 1,
    "ExposureTime": 0.06666666666666667,
    "CompositeImage": 2,
    "ExposureProgram": 2,
    "WhiteBalance": 0,
    "ShutterSpeedValue": 3.9085506496196545,
    "LensModel": "iPhone SE (2nd generation) back camera 3.99mm f/1.8",
    "ExifVersion": "0232",
    "ISOSpeedRatings": [
      1250
    ],
    "LensSpecification": [
      3.99,
      3.99,
      1.8,
      1.8
    ],
    "LensMake": "Apple",
    "SensingMethod": 2,
    "DateTimeDigitized": "2024:10:09 08:09:01",
    "ExposureMode": 0,
    "FNumber": 1.8,
    "DateTimeOriginal": "2024:10:09 08:09:01",
    "FocalLength": 3.99,
    "SubsecTimeDigitized": "524",
    "OffsetTimeOriginal": "+02:00",
    "SubjectArea": [
      2013,
      1511,
      2116,
      1330
    ],
    "OffsetTimeDigitized": "+02:00",
    "OffsetTime": "+02:00"
  }

In my code, I am trying to compare PixelXDimension and PixelYDimension from the metadata and calculate if the photo is landscape or portrait. The problem is that these values are the same for both photos although they have different orientations.

On the contrary, the same photos taken with the android app return the expected result.
Landscape photo metadata from an android app:

    "Orientation": "0",
    "PixelXDimension": "4624",
    "PixelYDimension": "3472",

Portrait photo metadata from an android app:

    "Orientation": "0",
    "PixelXDimension": "3472",
    "PixelYDimension": "4624",

Expected Behavior

I expect to get proper photo dimensions based on the photo orientation. So if the photo is taken landscape I expect to get the XDimension wider then the YDimension. And if the photo is taken as a portrait than the YDimension should be bigger than XDimension.

Project Reproduction

https://github.com/sakonn/probable-octo-invention

Additional Information

No response

@sakonn sakonn added the triage label Oct 9, 2024
@eric-horodyski eric-horodyski transferred this issue from ionic-team/capacitor Oct 11, 2024
@ionitron-bot ionitron-bot bot removed the triage label Oct 11, 2024
@eric-horodyski
Copy link
Member

This issue relates to Camera functionality, which is part of @capacitor/camera, and as such as been transferred to the appropriate repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants