在我正在开发的应用程序中,我有一个部分让用户使用 UIImagePicker 加载图像(从他们的照片库或拍摄新照片),这样做通常会提供大图像分辨率..2500x2000(或类似的东西)
现在我将该图像加载到 UIImageView 中(让我们说 400x320)。然后,我允许用户选择其他图像/对象以覆盖在原始图像之上并移动它们/调整它们的大小,然后他们才能将新图片保存到他们的照片库或通过电子邮件发送。
我只是想知道保存图像的最佳方法是什么,以使图像分辨率仍然与原始图像一样高....现在我只是截取屏幕截图,但这给我留下了一张 400x320 的小图像。
谢谢!
所以我得到了我想要的,不知道我是否以正确的方式做到了。
这基本上就是我所做的。
//NEWWIDTH and NEWHEIGHT are double the width and height of the UIImageView that i can edit the pictures in
CGSize newSize = CGSizeMake(NEWWIDTH, NEWHEIGHT);
UIGraphicsBeginImageContext(newSize);
//i'm resizing myOriginalImage before to how i want
[myOriginalImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *image;
//Here i go through all the other pictures i added on top and go the same drawInRect method for each of them...multiplying each value x,y,height,width by 2
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;