Reputation: 55
Making an app where we want to send a photo to a server along with some form data. The image is huge and it takes forever to upload and we really don't need the pixel information on the website. Is there any way to resize an image (from camera or your gallery) so that we're only sending a much smaller image into cyberspace? This is easy to do in Android but we're struggling to find an easy solution for iPhone.
Upvotes: 0
Views: 845
Reputation: 63697
See Resize a UIImage the right way for resizing code and discussion. To pick the image you can do
// 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];
}
Upvotes: 1
Reputation: 2568
In UIImage:
+ (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation
Just scratching out an idea...
UIImage smallerImage = [[ UIImage imageWithCGImage: biggerImage.CGImage scale: 0.1 orientation: orient
Upvotes: 0
Reputation: 393
The most of you question issues is covered by WWDC 2010 session N104. There is a scroll views, but methods, which described there can be using in you task.
Upvotes: 0