我目前正在使用 UIGraphicsGetImageFromCurrentImageContext() 将内容的图像保存到用户的相机胶卷中,但图像质量比我在模拟器中进行屏幕截图时差。有什么办法可以改善吗?保存的图像到底是什么格式? BMP?有什么办法可以改变吗?
这是我的保存代码:
CGSize size = [content bounds].size;
UIGraphicsBeginImageContext(size);
[[content layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *originalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(originalImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
最佳答案
而不是使用 UIGraphicsBeginImageContext
你应该使用:
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
关于ios - 来自 UIGraphicsGetImageFromCurrentImageContext() 的更好质量的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18030323/