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.
I'm using .net 5.0 and MetadataExtractor to make this
Edit : I was searching the wrong informations, I'd have the same informations that windows give, I want the EXIF informations instead.
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));