gpt4 book ai didi

iphone - 如何将图像保存到 iPhone 中的照片而不损失质量?

转载 作者:行者123 更新时间:2023-12-03 19:31:40 25 4
gpt4 key购买 nike

当我使用此方法时,保存的图像的质量将会下降......

UIImage *img=imageview1.image;
UIImageWriteToSavedPhotosAlbum(img,nil,nil,nil);

最佳答案

您需要将图像封装为 PNG 表示形式,以便以 PNG 格式(而不是 JPG 格式)保存到照片库中。

我根据 Ben Weiss 的代码使用了以下代码:UIImageWriteToSavedPhotosAlbum saves to wrong size and quality进行并排比较。

// Image contains a non-compressed image stored within my Documents directory
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
NSData* imdata = UIImagePNGRepresentation ( image );
UIImage* im2 = [UIImage imageWithData:imdata];
UIImageWriteToSavedPhotosAlbum(im2, nil, nil, nil);

图像将以 PNG 格式保存在照片库中,以便稍后以完整质量访问/共享。

关于iphone - 如何将图像保存到 iPhone 中的照片而不损失质量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2405472/

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