I'm tying to set the DateTaken parameter with C#, because I've got a lot of photos without this date. I only found this comment changing-datetaken-of-a-photo In this toppic they are changing it and not creating it.
If use this function, but DataTakenProperty1 or DataTakenProperty2 is null and can not be set.
private static void SetDateTaken(string path, DateTime NEWdate)
{
Image theImage = new Bitmap(path);
PropertyItem[] propItems = theImage.PropertyItems;
Encoding _Encoding = Encoding.UTF8;
var DataTakenPropert = propItems.SetValue(NEWdate.ToString("yyyy:MM:dd HH:mm:ss"), ??How do i know the index??);
theImage.SetPropertyItem(DataTakenProperty);
string new_path = Path.GetDirectoryName(path) + "\\_" + Path.GetFileName(path);
theImage.Save(new_path);
theImage.Dispose();
}
Thanks for your help