【发布时间】:2011-05-18 20:26:21
【问题描述】:
制作一个我们想要将照片连同一些表单数据发送到服务器的应用。图片很大,上传需要很长时间,我们真的不需要网站上的像素信息。有什么方法可以调整图像的大小(来自相机或您的画廊),以便我们只将更小的图像发送到网络空间?这在 Android 中很容易做到,但我们正在努力为 iPhone 找到一个简单的解决方案。
【问题讨论】:
标签: iphone resize photo crop autoresize
制作一个我们想要将照片连同一些表单数据发送到服务器的应用。图片很大,上传需要很长时间,我们真的不需要网站上的像素信息。有什么方法可以调整图像的大小(来自相机或您的画廊),以便我们只将更小的图像发送到网络空间?这在 Android 中很容易做到,但我们正在努力为 iPhone 找到一个简单的解决方案。
【问题讨论】:
标签: iphone resize photo crop autoresize
请参阅Resize a UIImage the right way 调整代码大小和讨论。要选择图像,您可以这样做
// select image
UIImagePickerController *picker = [UIImagePickerController new];
picker.delegate = self;
picker.allowsEditing = YES;
[yourViewController presentModalViewController:picker];
// delegate method
- (void) imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
}
【讨论】:
WWDC 2010 会议 N104 涵盖了大多数问题。有一个滚动视图,但是描述的方法可以在你的任务中使用。
【讨论】:
在 UIImage 中:
+ (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation
只是想出一个想法......
UIImage smallerImage = [[ UIImage imageWithCGImage: biggerImage.CGImage scale: 0.1 orientation: orient
【讨论】: