我想从图片中获取exif。我如何做到最好?

NSData *dataOfImageFromGallery = UIImageJPEGRepresentation (workingImage,0.5);

CGImageSourceRef imageSource;
imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)dataOfImageFromGallery, NULL);

if (imageSource == NULL) {
    // Error loading image ...
     return; }

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], (NSString *)kCGImageSourceShouldCache, nil];
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (__bridge CFDictionaryRef)options);

if (imageProperties) {
    NSNumber *width = (__bridge NSNumber *)CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelWidth);
    NSNumber *height = (__bridge NSNumber *)CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelHeight);

    CFRelease(imageProperties);

    NSLog(@"width: %@", width);
    NSLog(@"height: %@", height);
}


此打印widthheight,但EXIF属性在CGImageProperties.h库文件的ImageIO.h中大约为40,而我不知道如何一次打印所有内容。

最佳答案

使用exiftool,
我的simple project基于exiftool

关于iphone - 如何从照片获取exif?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8792374/

10-10 20:40