Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController - crops picture to square (in portrait)

I'm using the UIImagePickerController to take and edit a picture. it works fine in landscape, but in portrait it will crop the picture into a square (does not allow to reduce the image to fit fully into the square crop field like in landscape. Any ideas?

code:

-(IBAction)initCamera:(id)sender{

//Init imagePicker instance
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];

[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setShowsCameraControls:YES];
[imagePicker setAllowsEditing:YES];

[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
}
like image 224
cabhara Avatar asked Feb 20 '12 14:02

cabhara


1 Answers

Check out GKImagePicker library, it allows to set your custom image crop area, like this:

self.imagePicker = [[GKImagePicker alloc] init];
self.imagePicker.cropSize = CGSizeMake(320, 90);
self.imagePicker.delegate = self;

[self presentModalViewController:self.imagePicker.imagePickerController animated:YES];
like image 113
Andrey Zverev Avatar answered Oct 15 '22 09:10

Andrey Zverev