gpt4 book ai didi

ios - 来自 UIGraphicsGetImageFromCurrentImageContext() 的更好质量的图像

转载 作者:技术小花猫 更新时间:2023-10-29 10:18:55 28 4
gpt4 key购买 nike

我目前正在使用 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com