Closed vishnuP-Lepton closed 2 years ago
Hi there,
Thanks for the response
I am using image_picker: ^0.8.4+3 and native_exif: ^0.1.1 when I upload the image from Camera in Android device its showing the GPS_Latitude and GPS_Longitude in exif detail but same code are not working for iPhone device
my code is
void getExif(String imagePath) async {
final exif = await Exif.fromPath(imagePath);
final _attributes = await exif.getAttributes();
repository.isIndicatorHide(true);
await CommonUtils().getCurrentLatLng().then((currentPosition) async {
if (currentPosition != null) {
print(" before attribute = ${_attributes['GPSLatitude']}");
print(" before attribute = ${_attributes['GPSLongitude']}");
String radianLatLng =
Run(currentPosition.latitude, currentPosition.longitude);
List<String> lstradianLatLng = radianLatLng.split(" ");
_attributes['GPSLatitude'] = lstradianLatLng[0];
_attributes['GPSLongitude'] = lstradianLatLng[1];
await exif.writeAttributes(_attributes);
var attributes = await exif.getAttributes();
print(" after attribute = ${attributes['GPSLatitude']}");
print(" after attribute = ${attributes['GPSLongitude']}");
print(attributes);
cameraImage();
}
});
}
I ran into the same issue on iOS with physical device (not tested on Android) - added attributes not getting saved.
I cloned this repo and found that the "Update date attribute and add new attribute" does not do anything - the 'ImageUniqueID' does not get written and no error reported.
The "Create file and write exif data" seems to be working. However, after copying it verbatim to my own project, writing attribute was not working - no error but retrieving attributes results in the original set of attributes and no error indication.
I found that user comment metadata gets written, while GPS metadata does not. Looking at another implementation (in Objective-C), it appears GPS metadata can be written with another, GPS-specific dictionary of the metadata. Since this implementation uses only metadata["{Exif}"]
throughout, I bet writing GPS Exif was never tested.
native_exif
didn't support GPS attributes on iOS devices. The referenced commit adds this feature (included in Version 0.2.0).
We also removed the ImageUniqueID
example. Thanks for noting this.
Only specific EXIF and GPS attributes can be read or written on each platform. Please have a look at the updated README file for more details.
@vgribok & @d-kuen Thanks for response,
I found that in read me file that iOS also support exif & GPS which should be specific case.
Let me know what are specific GPS attribute are supported in iOS.
You should be able to use all keys, listed at https://developer.apple.com/documentation/imageio/gps_dictionary_keys.
Please make sure to use the resolved values and prefix them with GPS
.
The resolved values may be the same as the part after kCGImagePropertyGPS
but I didn't check all of them.
Thank you for submitting this issue. Can you please provide further information about what is "not working". Please use the issue description for that. Thanks!