bigflood / dartexif

Dart package to decode Exif data from tiff, jpeg and heic files
https://pub.dev/packages/exif
MIT License
30 stars 29 forks source link

dartexif reports 0/0, 0/0, 0/0 for lat/lon, but file is geotagged #40

Open abhlabs opened 1 year ago

abhlabs commented 1 year ago

exif.tools web site reports the correct lat/lon, but all I see in the data from dartexif is this:

I/flutter (25377): GPS GPSVersionID: [0, 0, 0, 0] I/flutter (25377): GPS GPSLatitudeRef: I/flutter (25377): GPS GPSLatitude: [0/0, 0/0, 0/0] I/flutter (25377): GPS GPSLongitudeRef: I/flutter (25377): GPS GPSLongitude: [0/0, 0/0, 0/0] I/flutter (25377): Image GPSInfo: 1012 I thought maybe the file had GPS info stripped out, so i transferred it from the android emulator to my windows desktop, then uploaded to exif.tools web site, and it reports the correct lat/lon.

Is there something wrong in my process?

SG-XM commented 1 year ago

i'm facing the same promblem in android api33

image
abhlabs commented 1 year ago

i'm facing the same promblem in android api33

In my case, I discovered that images picked directly from the "downloads" folder had their GPS information stripped. The GPS info was in the file, and that's why I was able to see it when I transferred the file back to Windows and used other tools. Something about picking the file directly from "Downloads" causes the GPS to be stripped.

How I got around that problem was to initiate the selection using the "Photos" app, then navigate to "Downloads". Then when you inspect the exif tags, I started seeing valid GPS data. I don't think this is an issue with dartexif, and it may not be an issue with the Dart Image Picker package (which I'm using to do the photo file selection) -- I think it has something to do with Android security.

Hope this helps!

RafatMeraz commented 11 months ago

i'm facing the same promblem in android api33 image

Facing same issue for Android 13 only. For android 12, it's working fine. Please let me know if you found any solution yet.

RafatMeraz commented 11 months ago

i'm facing the same promblem in android api33

In my case, I discovered that images picked directly from the "downloads" folder had their GPS information stripped. The GPS info was in the file, and that's why I was able to see it when I transferred the file back to Windows and used other tools. Something about picking the file directly from "Downloads" causes the GPS to be stripped.

How I got around that problem was to initiate the selection using the "Photos" app, then navigate to "Downloads". Then when you inspect the exif tags, I started seeing valid GPS data. I don't think this is an issue with dartexif, and it may not be an issue with the Dart Image Picker package (which I'm using to do the photo file selection) -- I think it has something to do with Android security.

Hope this helps!

But in my scenario, I am picking my images from gallery via File picker.

Flajt commented 11 months ago

Have a look at this: android docs. You might need an extra permission for this to work.

ankhanguit commented 11 months ago

Have a look at this: android docs. You might need an extra permission for this to work.

Thank Flajt. i think you are right. For who need to access GPS information from Exif of media file on Android, you may need to ensure that:

  1. Add ACCESS_MEDIA_LOCATION permission to your AndroidManifest.xml file

  2. Before using the file picker like ImagePicker. you may have to request media location access permission. on my source, i use permission_handler: https://pub.dev/packages/permission_handler.

var status = await Permission.accessMediaLocation.status; if (!status.isGranted) { await Permission.accessMediaLocation.request(); }

Hope it help!

sachinbpatil619 commented 10 months ago

i am also facing same issue. i am using image_picker: ^1.0.4.

   final fileBytes = File(widget.imageFile.path).readAsBytesSync();
   final data = await readExifFromBytes(fileBytes);

i am getting GPSLatitude and GPSLongitude 0/0,0/0,0/0

i have tried by doing

   if (!status.isGranted) {
   //not prompting the any permission request here
  await Permission.accessMediaLocation.request();
}

//getting photo from gallery final pickedImage = await ImagePicker().pickImage(source: ImageSource.photos);

where as by doing 

    final pickedImage = await ImagePicker().pickImage(source: ImageSource.photos);

    i am getting location info.
svoza10 commented 10 months ago

i am also facing same issue. i am using image_picker: ^1.0.4.

   final fileBytes = File(widget.imageFile.path).readAsBytesSync();
   final data = await readExifFromBytes(fileBytes);

i am getting GPSLatitude and GPSLongitude 0/0,0/0,0/0

i have tried by doing

   if (!status.isGranted) {
   //not prompting the any permission request here
  await Permission.accessMediaLocation.request();
}

//getting photo from gallery final pickedImage = await ImagePicker().pickImage(source: ImageSource.photos);

where as by doing 

    final pickedImage = await ImagePicker().pickImage(source: ImageSource.photos);

    i am getting location info.

Have you tried file_picker for picking photos?