An Image can contain additional Information about the Camera or the Date it was taken. It’s quite easy to access those Information with C-Sharp. All you need to do is to add a Reference to PresentationCore
and WindowsBase
, include the System.Windows.Media.Imaging
Namespace and use the following Code-Snippet as a StartingPoint:
public DateTime GetDateTaken(string filePath) { using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { BitmapFrame bitmapFrame = BitmapFrame.Create(fileStream, BitmapCreateOptions.DelayCreation, BitmapCacheOption.None); BitmapMetadata bitmapMetadata = bitmapFrame.Metadata as BitmapMetadata; return DateTime.Parse(bitmapMetadata.DateTaken); } }