我正在使用 ImageIO框架来更新UIImage的元数据然后在我的iphone photoLibrary中保存该图像之后我的问题是我在图像中成功更新了Image TIFF数据但是当我选择该图像时获取TIFF数据然后它不显示TIFF字典数据。在线我可以看到更新的TIFF数据但在我的代码中我看不到它。
更新了TIFF数据:
"{TIFF}" = {
Make = "test ";
Model = test;
Software = test;
};
在iOS中获取更新的图像元数据
{
ColorModel = RGB;
Depth = 8;
PixelHeight = 2592;
PixelWidth = 1936;
"{PNG}" = {
InterlaceType = 0;
};
}
代码:
NSData *imageData = UIImagePNGRepresentation(image);
CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef )imageData, NULL);
if (imageSource == NULL) {
// Error loading image
return nil;
}
//Set the object in dictinary
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], (NSString *)kCGImageSourceShouldCache,
nil];
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (__bridge CFDictionaryRef)options);
//Device name
CFDictionaryRef refDeviceInfo = CFDictionaryGetValue(imageProperties, kCGImagePropertyTIFFDictionary);
if (refDeviceInfo) {
NSString *strMake = (NSString *)CFDictionaryGetValue(refDeviceInfo, kCGImagePropertyTIFFMake);
NSLog(@"Make: %@", strMake);
NSString *strModel = (NSString *)CFDictionaryGetValue(refDeviceInfo, kCGImagePropertyTIFFModel);
NSLog(@"Model: %@", strModel);
}