Platform Pub Package License: MIT Donate Issue Forks Stars

metadata is a dart library to extract exif data of the images.

Support ❤️❤️

Thanks for being kind and hitting the support button. Much Appreciated 🙌!!

Table of Contents

Lets Get Started

1. Depend on it

Add this to your package's pubspec.yaml file:

  metadata: any

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:metadata/metadata.dart';



    import 'package:metadata/metadata.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 awesome 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 = 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}');

Extract Exif Data with callback

    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}');

Extract XMP Data

    var mapResult = MetaData.extractXMP(bytes);
    saveFile(image_name, mapResult);

Saving exif content into File

      void saveFile(String fileName, dynamic exifContent) {