cloudacy / native_exif

A simple EXIF metadata reader/writer for Flutter.
MIT License
16 stars 14 forks source link

Exif atributes only change in android emulator. #11

Open Hash1mot0 opened 1 year ago

Hash1mot0 commented 1 year ago

Hello, I'm having a problem where the image exif attributes only change in android emulator, but when I'm trying in a real smartphone (S20fe) the exif does not change or update.

Heres the code part:

final exif = await Exif.fromPath(imagefile); debugPrint('Image file has been loaded');

final attributes = await exif.getAttributes();

await exif.writeAttribute('DateTimeOriginal', videoDate!);

if(location!=null) { await exif.writeAttributes({ 'GPSLatitude': lat, 'GPSLatitudeRef': latRef, 'GPSLongitude': lon, 'GPSLongitudeRef': lonRef, }); }

debugPrint('Date time altered to:'); debugPrint(videoDate.toString());

debugPrint('Location altered to:'); debugPrint('$lat$latRef $lon$lonRef');

final result = await exif.writeAttributes(attributes!); await exif.close();

debugPrint('Image attributes has been set');

d-kuen commented 1 year ago

Hi,

we can't reproduce this behavior.

We think all data gets reset at

final result = await exif.writeAttributes(attributes!);

if attributes already includes DateTimeOriginal, GPSLatitude, GPSLatitudeRef, GPSLongitude and GPSLongitudeRef.

That may be your issue here.

The example app now also includes a Update, store and reload attributes button. It updates some attributes, copies the image to a new temporary file and loads it's EXIF data. Please click this button and check the debug prints to verify if attributes are not updated on a real device. If so, please post the results here.

Thanks.