2010-09-01 55 views
0

我的應用程序允許從相機膠捲上載圖像。上載前我試圖將它們保存到我的文檔目錄時,某些圖像導致應用程序崩潰。我在保存之前將圖像轉換爲PNG,但這沒有幫助。這裏的錯誤...iPhone在某些圖像格式上窒息

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 ... 

} 
+0

您應該在附近發生崩潰的地方提供代碼。你所得到的錯誤只是說你正在使用無效的上下文來操縱你的圖像。 – vfn 2010-09-01 02:52:28

回答

0

還要注意的是,你在做什麼是多餘的,浪費內存。 imgpngImg是一樣的。還是有一個特定的原因,你將圖像轉換爲PNG,然後回到圖像?