Getting NSDate from EXIF of a image
Getting NSDate from EXIF of a image
- Subject: Getting NSDate from EXIF of a image
- From: Jushin <email@hidden>
- Date: Mon, 2 Mar 2009 22:00:25 -0500
I need to get time and date from EXIF of a image.
Following is the code snippet I used:
NSDictionary *metadata = (NSDictionary *)
CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
NSMutableDictionary *muMetadata = [[metadata mutableCopy] autorelease];
[metadata release];
NSMutableDictionary *EXIFDictionary = [[[muMetadata
objectForKey:(NSString *)kCGImagePropertyExifDictionary]
mutableCopy] autorelease];
NSString *EXIFDate = [[EXIFDictionary objectForKey:(NSString
*)kCGImagePropertyExifDateTimeDigitized] retain];
NSLog(EXIFDate);
NSDate *aDate = [[NSDate alloc] initWithString: EXIFDate];
Here are my questions:
1. the last line, NSDate *aDate returns null.
I think it is because the format of EXIFDate string that was created
right above isn't correct.
When I did NSLog(EXIFDate), I get followings:
2008:11:06 19:12:51
According to the NSDate documentation, string format of time should be:
2008-11-06 19:12:51
2. the returned date string (EXIFData) doesn't have timezone information.
Is it possible to get timezone info as well from the EXIF information?
3. Well... eventually what I want to do is, I want to create "unix
time" format of date from image EXIF using timeIntervalSince1970.
Is there any other better way to get this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden