xmp 1.0.0
xmp: ^1.0.0 copied to clipboard
XMP module helps to extract xmp data from images.
XMP #
xmp module helps to extract xmp data of the images. It is purely written in dart, So it can be used on server as well as on client.
Table of Contents #
Lets Get Started #
1. Depend on it #
Add this to your package's pubspec.yaml
file:
dependencies:
xmp: ^1.0.0
2. Install it #
You can install packages from the command line:
with pub
:
$ pub get
3. Import it #
Now in your Dart
code, you can use:
import 'package:xmp/xmp.dart';
Usage #
Imports #
import 'package:xmp/xmp.dart';
Read Image File #
var file = "path_to_pre_existing_image_file/image.jpg";
var bytes = File(file).readAsBytesSync();
Read Image from Flutter's Asset Folder #
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);
Extract Exif Data #
var result = XMP.extract(bytes);
saveFile(image, result);
Result #
{
"raw": {
"MicrosoftPhoto:LastKeywordXMP": [
"tag1",
"tag2"
],
"MicrosoftPhoto:Rating": "50",
"xmp:Rating": "3",
"dc:title": "Title",
"dc:description": "Title",
"dc:subject": "tag2"
},
"keywords": [
"tag1",
"tag2"
],
"rating": 3,
"title": "Title",
"description": "Title",
"subject": "tag2"
}
Saving exif content into File #
void saveFile(String fileName, dynamic exifContent) {
File('${path}$fileName.json').writeAsStringSync(jsonEncode(exifContent));
}
Also checkout our other libraries on:
Donate #
Ooooops, My laptop is slow, but I'm not.