Hi,
I am attempting to iterate through all image files in a folder and it's subfolders to check for the EXIF property of DateTimeOriginal.
For the life of me I cannot seem to work out how do this, I can work it fine by just entering a single Path in the Bitmap but not when it comes to cycling through the entire directory.
This is the code I am playing around with:
///try
///{
string[] filePaths = Directory.GetFiles(@"C:\Users\1CM69\Pics & Vids\Archives\Family\", "*.*", SearchOption.AllDirectories);
///foreach (string file in filePaths);
Bitmap MyPhoto = new Bitmap(filePaths);
const int IDDateTimeOriginal = 36867;
PropertyItem TakenDate = MyPhoto.GetPropertyItem(IDDateTimeOriginal);
Encoding ascii=Encoding.ASCII;
string DateTaken=ascii.GetString(TakenDate.Value,0,TakenDate.Len-1);
MessageBox.Show(DateTaken);
/// }
///catch (ArgumentException) //if the property doesn't exists
///{ MessageBox.Show("no entry available"); }
As you can see, I have commented out some sections just for debugging purposes.
I think that the main issue is with the section:
new Bitmap(filePaths);
I have run out of ideas to solve this and any help would be appreciated.
Kindest regards..,