如何从iOS中的THM文件中提取exif数据?

时间:2014-07-31 23:58:47

标签: ios objective-c core-graphics exif

我试图在THM文件的exif数据中查看媒体轨道创建日期。使用命令行实用程序exiftool,我能够看到此属性。如何使用目标c看到它?

这是我到目前为止所尝试过的。

 [self downloadImageWithURL:[candidateVideo objectForKey:@"thmURL"] completionBlock:^(BOOL succeeded, NSData *data) {
            if (succeeded) {
                CGImageSourceRef source=CGImageSourceCreateWithData((__bridge CFDataRef)data,NULL);
                NSDictionary* metaData=(__bridge NSDictionary*)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
                NSMutableDictionary* metaDataMutable=[metaData mutableCopy];
                    //recalculate validity with the images exif data
                NSMutableDictionary *EXIFDictionary = [[metaDataMutable objectForKey:(NSString *)kCGImagePropertyExifDictionary]mutableCopy];
                NSLog(@"wut");

            }
        }];

但我的EXIFDictionary是零。

我也试过这个,我的词典有一些关键值对,但只有3个,它们不是我需要的。我尝试过使用UIIMageJPEGRepresenation()UIImagePNGRepresentation()无济于事。太糟糕了,没有UIImageTHMRepresentation() ......

[self downloadImageWithURL:[candidateVideo objectForKey:@"thmURL"] completionBlock:^(BOOL succeeded, NSData *data) {
            if (succeeded) {
                    UIImage* thumbnail = [[UIImage alloc] initWithData:data];

                NSData* pngData=UIImageJPEGRepresentation(thumbnail,1.0);
                CGImageSourceRef source=CGImageSourceCreateWithData((__bridge CFDataRef)pngData,NULL);
                NSDictionary* metaData=(__bridge NSDictionary*)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
                NSMutableDictionary* metaDataMutable=[metaData mutableCopy];
                    //recalculate validity with the images exif data
                NSMutableDictionary *EXIFDictionary = [[metaDataMutable objectForKey:(NSString *)kCGImagePropertyExifDictionary]mutableCopy];
                NSLog(@"wut");

            }
        }];

0 个答案:

没有答案