metadata is a dart library to extract exif data of the images. It is purely written in dart, So it can be used on server as well as on client.
Add this to your package's pubspec.yaml
file:
dependencies:
metadata: ^1.0.2
You can install packages from the command line:
with pub
:
$ pub get
Now in your Dart
code, you can use:
import 'package:metadata/metadata.dart';
import 'package:metadata/metadata.dart';
var file = "path_to_pre_existing_image_file/image.jpg";
var bytes = File(file).readAsBytesSync();
import 'package:flutter/services.dart' show ByteData, rootBundle;
/* Your blah blah code here */
ByteData data = await rootBundle.load("assets/path_to_pre_existing_image_file/image.jpg";);
var bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
var result = MetaData.exifData(bytes);
if (result.error == null) {
var content = result.exifData; // exif data is available in contents
saveFile(image_name, content);
} else {
print('File: $image.jpg, Error: ${result.error}');
}
MetaData.exifData(bytes, onValue: (CallBack result) {
if (result.error == null) {
var content = result.exifData;
saveFile(image_name, content);
} else {
print('File: $image.jpg, Error: ${result.error}');
}
});
var mapResult = MetaData.extractXMP(bytes);
print(mapResult.toString());
saveFile(image_name, mapResult);
void saveFile(String fileName, dynamic exifContent) {
File('${path}$fileName.json').writeAsStringSync(jsonEncode(exifContent));
}
On-going implementation for future:
- metadata of audio and video files
- extracting file-types
- Excel ·······> Excel
- Protect ···············> Protect
- Text Animations ··> AnimatedText
- Translations ·······> Arb Translator
Ooooops, My laptop is slow, but I'm not.