Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 为缩略图复制图像的功能?_Ios_Objective C_Image_Duplicates_Compression - Fatal编程技术网

Ios 为缩略图复制图像的功能?

Ios 为缩略图复制图像的功能?,ios,objective-c,image,duplicates,compression,Ios,Objective C,Image,Duplicates,Compression,我正在制作一个照片库应用程序 我正在压缩图像 NSData *imageData = UIImageJPEGRepresentation(image,0.5) 然后想创建一个副本(用于缩略图),我将进一步压缩它 NSData *imageData = UIImageJPEGRepresentation(image,0.2) 我有点被困在如何创建副本的中间步骤上,有人知道是否有用于此的函数吗?也许您可以将NSData转换为UIImage 迅捷3: let imageData = UIImage

我正在制作一个照片库应用程序

我正在压缩图像

NSData *imageData = UIImageJPEGRepresentation(image,0.5)
然后想创建一个副本(用于缩略图),我将进一步压缩它

NSData *imageData = UIImageJPEGRepresentation(image,0.2)

我有点被困在如何创建副本的中间步骤上,有人知道是否有用于此的函数吗?

也许您可以将
NSData
转换为
UIImage

迅捷3:

let imageData = UIImageJPEGRepresentation(thumbImage,0.5)
let thumbImage = UIImage(data:UIImageJPEGRepresentation(UIImage(data: imageData),0.2))
目标C:

NSData *imageData = UIImageJPEGRepresentation(image,0.5)
UIImage *thumb = [UIImage imageWithData: UIImageJPEGRepresentation([UIImage imageWithData: imageData],0.5)];

你想做什么…解释更多…看看: