你可以使用蘋果自己的API來獲取圖像Exif。
這裏是一個CGImageSource Reference 而CGimageProperties
她的是一個簡單的例子:
NSURL *imageFileURL = [NSURL fileURLWithPath:@"/Users/USERNAME/Documents/tasting_menu_004.jpg"];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)imageFileURL, NULL);
NSDictionary *treeDict;
NSMutableString *exifData;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], (NSString *)kCGImageSourceShouldCache,
nil];
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (CFDictionaryRef)options);
CFRelease(imageSource);
if (imageProperties) {
treeDict = [NSDictionary dictionaryWithDictionary:(NSDictionary*)(imageProperties)];
id exifTree = [treeDict objectForKey:@"{Exif}"];
exifData = [NSMutableString stringWithString:@""];
for (NSString *key in [[exifTree allKeys] sortedArrayUsingSelector:@selector(compare:)])
{
NSString* locKey = [[NSBundle bundleWithIdentifier:@"com.apple.ImageIO.framework"] localizedStringForKey:key value:key table: @"CGImageSource"];
id value = [exifTree valueForKey:key] ;
[exifData appendFormat:@"key =%@ ; Value = %@ \n", locKey,value];
}
NSLog(@" exifData %@", exifData);
日誌 - > exifData
鍵=光圈值;值= 4。643856
key = Color Space;值= 65535
key = Custom Rendered;值= 0
key =日期時間數字化;值= 2013:06:13 08:35:07
key = Date Time Original;值= 2013:06:13 08:35:07
key = Exif Version;值=( 2, 2,)
鍵=曝光補償值;值= 0
key =曝光模式;值= 1
key =曝光程序;值= 1
key =曝光時間;值= 0.0125
key = FNumber;值= 5
key = Flash;值= 9
key =焦距;值= 17
key =焦平面分辨單元;值= 2
key =焦平面X分辨率;值= 3849.211788896504
key =焦平面Y分辨率;值= 3908.141962421712
key = ISO Speed Ratings;值=()
key =最大孔徑值;值= 4
key =測光模式;值= 5
key = Pixel X Dimension;值= 5181
key = Pixel Y Dimension;值= 3454
key = Scene Capture Type;值= 0
key =快門速度值;值= 6.321928
key = Subject Distance;值= 1.22
key =亞秒時間數字化;值= 25
key =亞秒時間原始值;值= 25
key =白平衡;值= 0
我正在深入這篇文章,到目前爲止,它看起來可能會得到我所需要的:http://stackoverflow.com/questions/6083372/mac-os-x-10-6-apis -report-incorrect-exif-data-for-aperture我會在驗證時報告。 –