bigflood / dartexif

Dart package to decode Exif data from tiff, jpeg and heic files
https://pub.dev/packages/exif
MIT License
31 stars 30 forks source link

exif datas not found with CR3 pictures #48

Open alaindeseine opened 10 months ago

alaindeseine commented 10 months ago

Hi, I am trying to extract exif data to get the DateTimeOriginal information. The script work very well with JPEG and Nikon NEF files. But with Canon CR3 files, i get an empty list from the readExifFromBytes function.

Here is the script i use:

import 'dart:io';
import 'package:exif/exif.dart';
import 'package:exif_test/exif_test.dart' as exif_test;

void main(List<String> arguments) async {
  // String filename = './DSC_0700_038.JPG';
  // String filename = './DSC_1270.NEF';
  String filename = './OD2_2676.CR3';

  print("read $filename ...");

  final fileBytes = File(filename).readAsBytesSync();
  final data = await readExifFromBytes(
    fileBytes,
    // debug: true,
  );

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

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

  for (final entry in data.entries) {
    print("${entry.key}: ${entry.value}");
  }
}

Do I miss something? Or is there a restriction for extracting EXIF data from Canon CR3 files?

Il also try with a node.js script i wrote with the npmjs exiftools-vendored package and i can réead exif datas from CR3 file with this javascript package. So i am shure that EXC-IF datas are present in this CR3 file.