2
以下代码将PDF页转换为JPEG。它按预期运行在Snow Leopard上:编译时的iPhone,因为核芯显卡的iPhone版本不包括CGImageDestinationRef
是否可以在iPhone上使用Core Graphics保存图像?
...
//get the image from the bitmap context
CGImageRef image = CGBitmapContextCreateImage(outContext);
//create the output destination
CGImageDestinationRef outfile = CGImageDestinationCreateWithURL(fileUrl, kUTTypeJPEG, 1, NULL);
//add the image to the output file
CGImageDestinationAddImage(outfile, image, NULL);
CGImageDestinationFinalize(outfile);
...
此代码失败。有什么方法可以使用原生iPhone框架和库将CFImageRef
保存为jpeg吗?我能想到的唯一选择是放弃Core Graphics并使用ImageMagick。