I need to get image taken date without exif extra libraries, what I found in documentations, doesn't work for me :
CGImageSource myImageSource;
myImageSource = CGImageSource.FromUrl (url, null);
var ns = new NSDictionary ();
var imageProperties = myImageSource.CopyProperties (ns, 0);
var date = imageProperties [ImageIO.CGImageProperties.ExifSubsecTimeOrginal];
var date2 = imageProperties [ImageIO.CGImageProperties.ExifDateTimeDigitized];
var date3 = imageProperties [ImageIO.CGImageProperties.TIFFDateTime];
all of them is null , but image has taken date, when I check it with exif library.
what is not correct?
here is my solution, not sure how perfect it is , but works for now
static DateTime GetMyImageTakenDate (NSUrl url)
{
DateTime takenDate = DateTime.Today;
CGImageSource myImageSource;
myImageSource = CGImageSource.FromUrl (url, null);
var ns = new NSDictionary ();
var imageProperties = myImageSource.CopyProperties (ns, 0);
NSObject date = null;
var exifDictionary = imageProperties.ValueForKey (ImageIO.CGImageProperties.ExifDictionary);
if (exifDictionary != null) {
date = exifDictionary.ValueForKey (ImageIO.CGImageProperties.ExifDateTimeOriginal);
}
takenDate = date != null ? DateTime.ParseExact (date.ToString (), "yyyy:MM:dd HH:mm:ss", null) : takenDate;
return takenDate;
}