iPhone窒息某些图像格式

时间:2010-09-01 02:46:55

标签: iphone quartz-graphics

我的应用程序允许从相机胶卷上传图像。当我尝试在上传之前将它们保存到我的文档目录时,某些图像导致应用程序崩溃。我在保存之前将图像转换为PNG,但这没有帮助。这是错误...

Tue Aug 31 20:39:13 localhost XXX[76409] <Error>: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; kCGImageAlphaLast; 1600 bytes/row.
Tue Aug 31 20:39:13 localhost XXX[76409] <Error>: CGContextConcatCTM: invalid context 0x0
Tue Aug 31 20:39:13 localhost XXX[76409] <Error>: CGContextSetInterpolationQuality: invalid context 0x0
Tue Aug 31 20:39:13 localhost XXX[76409] <Error>: CGContextDrawImage: invalid context 0x0
Tue Aug 31 20:39:13 localhost XXX[76409] <Error>: CGBitmapContextCreateImage: invalid context 0x0

这是我的代码示例......

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

            UIImage *img =  [info objectForKey:@"UIImagePickerControllerOriginalImage"];

        NSData *pngData = UIImagePNGRepresentation(img);

        UIImage *pngImg = [UIImage imageWithData:pngData];

... code to save image ...

}

1 个答案:

答案 0 :(得分:0)

另请注意,您所做的事情是多余的,浪费内存。 imgpngImg是相同的。或者是否有特定原因将图像转换为png然后再转换回图像?