Home > Software design >  EXIF datetime returning null
EXIF datetime returning null

Time:02-08

I'm trying to get the date of creation of a picture with this code :

private void GetEXIFDate()
        {
            var directories = ImageMetadataReader.ReadMetadata(@"\\s2.rpn.ch\home\CPLN\Eleves\ET\CamiloDLe\My Pictures\Temp.jpg");
            var subIfdDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();
            var dateTime = subIfdDirectory?.GetDateTime(ExifDirectoryBase.TagDateTime);
            MessageBox.Show(dateTime.ToString());
        }

The MessageBox shows null and when i try to see the EXIF from windows i can see the modifiedDate and the date of creation.

Edit : subIfdDirectory is also null

CodePudding user response:

using MetadataExtractor;
using MetadataExtractor.Formats.Exif;
using MetadataExtractor.Formats.FileSystem;
using MetadataExtractor.Formats.FileType;

var directories = ImageMetadataReader.ReadMetadata(@"C:\Users\username\Pictures\output-onlinejpgtools.jpg");
var metadataDirectory = directories.OfType<FileMetadataDirectory>().FirstOrDefault();
Console.WriteLine(metadataDirectory.GetDateTime(3));
  •  Tags:  
  • Related