1
A
回答
6
導入imageIO框架並嘗試使用帶有時間戳的圖像。這裏是one,將它添加到您的項目中。
#import <ImageIO/ImageIO.h>
NSString *path = [[NSBundle mainBundle] pathForResource:@"gg_gps" ofType:@"jpg"];
NSURL *imageFileURL = [NSURL fileURLWithPath:path];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)CFBridgingRetain(imageFileURL), NULL);
// or you can get your imageSource this other way:
// NSData *data = [NSData dataWithContentsOfFile:path];
// CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], (NSString *)kCGImageSourceShouldCache, nil];
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (CFDictionaryRef)CFBridgingRetain(options));
CFDictionaryRef exifDic = CFDictionaryGetValue(imageProperties, kCGImagePropertyExifDictionary);
if (exifDic){
NSString *timestamp = (NSString *)CFBridgingRelease(CFDictionaryGetValue(exifDic, kCGImagePropertyExifDateTimeOriginal));
if (timestamp){
NSLog(@"timestamp: %@", timestamp);
} else {
NSLog(@"timestamp not found in the exif dic %@", exifDic);
}
} else {
NSLog(@"exifDic nil for imageProperties %@",imageProperties);
}
CFRelease(imageProperties);
相關問題
- 1. 從時間戳獲取本地時間
- 2. 從服務器獲取的時間戳本地時間戳
- 3. 如何從postgres獲取時間戳作爲時間戳?
- 4. v4l2圖像捕獲的時間戳
- 5. 獲取從時間戳偏秒差
- 6. 如何從numpy.datetime64獲取unix時間戳
- 7. 如何從網頁獲取時間戳
- 8. 從時間戳獲取日期
- 9. 如何從Oracle獲取EST時間戳?
- 10. 從網頁獲取時間戳?
- 11. 從Cassandra獲取最後的時間戳
- 12. 獲取未來時間戳
- 13. Cumulocity API獲取時間戳
- 14. 從Matlab中的時鐘圖像獲取時間 - 圖像處理
- 15. 基於從兩個不同線程獲取的時間戳匹配圖像
- 16. 從iPhone上的圖像獲取地理數據和時間戳sdk
- 17. 從SD卡文件獲取時間戳(日期和時間)
- 18. 從時間戳分開獲取時間和日期
- 19. 縮小圖像時保留時間戳
- 20. 獲取時間戳的時區
- 21. C#獲取帶時區的時間戳
- 22. 從時間戳
- 23. 從時間戳記提取SQL小時
- 24. 如何從時間戳間隔中獲取天數列表
- 25. PHP:從陣列獲取的時間戳數據之間
- 26. C#:在圖像上繪製時間戳
- 27. Rails在CSS中的圖像時間戳
- 28. 如何從本地時間戳獲取UTC時代值
- 29. 使用JavaScript獲取唯一時間戳
- 30. Mysql select - 獲取時間戳的日期
由於我已經有圖像作爲一個對象,我只用了註釋掉的部分代碼的最後兩行。 然而,Xcode中給我一個錯誤的地方告訴我(CFDataRef)切換到(__bridge CFDataRef),當我這樣做,我得到了一個rumtime錯誤說: 爲i386硬件架構未定義的符號: *大多數功能從代碼*。 ld:未找到架構的符號i386 clang:錯誤:鏈接器命令失敗,退出代碼1(使用-v查看調用)。 這是什麼意思? – Tom 2012-08-07 20:16:14
您需要將ImageIO框架添加到您的目標。 http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4 – 2012-08-07 22:20:47
對不起,我一直很慢...但我得到:「在時間戳中找不到時間戳」在我所有的iphone照片上。這是否意味着iphone有一個標準,在拍照時不會創建時間戳? – Tom 2012-08-10 13:13:13