Is there a way to get the metadata of a picture in Flutter?

Viewed 867

I am building an app where the users can upload the pictures from there phones. I would like to extract from the user's picture the metadata that shows the location that the picture was taken. How can I get it?

1 Answers

you can use exif package

final ByteData bytes = await rootBundle.load('assets/jpg/2.jpg');
var list = bytes.buffer.asUint8List();

final data = await readExifFromBytes(list);

if (data.isEmpty) {
  print("No EXIF information found");
  return;
}

if (data.containsKey('JPEGThumbnail')) {
  print('File has JPEG thumbnail');
  data.remove('JPEGThumbnail');
}

enter image description here

Related