我想从 iOS 照片库中读取 CMYK 图像。
例如CMYK 文件示例 在 Safari 中打开此文件并按住并保存到相机胶卷。
然后我使用 ALAsset 库在 UIImageView 中显示
[library assetForURL:asset resultBlock:^(ALAsset *asset) {
UIImage* image = [UIImage imageWithCGImage:asset.thumbnail];
imageView.image = image;
} failureBlock:^(NSError *error) {
imageView.image = nil;
}] ;
它导致几乎所有的黑色图像和丢失的颜色信息。我也试过
asset.defaultRepresentation.fullScreenImage;
asset.defaultRepresentation.fullResolutionImage;
所有结果都是黑色图像。
我也试图从这样的字节中读取。
ALAssetRepresentation* representation = [asset defaultRepresentation];
uint8_t *buffer = (Byte*)malloc(representation.size);
[representation getBytes:buffer fromOffset: 0.0 length:representation.size error:nil];
NSData *data = [[NSData alloc] initWithBytesNoCopy:buffer length:representation.size freeWhenDone:YES];
UIImage* image = [UIImage imageWithData:data];
这也显示全分辨率图像,但也只是黑色......
有趣的是,如果我从 web 目录获取数据到 UIImage,它就可以工作。
self.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.plaveb.com/blog/Upload/FCKeditor/image/cmyk-encoded-image.jpg"]]];
这产生了彩色图像。所以我的猜测是当将 CMYK 图像保存到相机胶卷时,它会丢失颜色信息并且无法再获得彩色图像。
问题是“是否可以从相机胶卷 CMYK 图像中获得彩色图像?”
我用 iOS 6.0.1 和 5.0、5.1 进行了测试。在 6.0.1 中,缩略图或全屏图像都无法显示彩色图像。奇怪的是在 iOS 5.0、5.1 中。只有缩略图可以显示彩色,但不能全屏显示。
任何想法将不胜感激!