12

I am using the IOS standard image cropping functionality (move and scale) to crop my image before submitting it to the server.

However, I realize that the cropping provided has a square ratio (see screenshot below)

enter image description here

Snippet of the code is as follows:

//set up image picker
self.imgPicker = [[[UIImagePickerController alloc] init]autorelease];
self.imgPicker.allowsEditing = YES;
self.imgPicker.delegate = self;

//Trigger get photo from library function
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.imgPicker animated:YES];

How can allow 'move and scale' editing and at the same time allow the user to do cropping WITHOUT the square ratio restriction?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Zhen
  • 12,361
  • 38
  • 122
  • 199
  • 2
    possible duplicate of [how to change the UIImagePickerController crop frame](http://stackoverflow.com/questions/998706/how-to-change-the-uiimagepickercontroller-crop-frame) – CodaFi Apr 13 '12 at 03:42
  • You're right CodaFi, this question has been asked all over stackoverflow. This thread can also be useful, as a user suggests his framework : http://stackoverflow.com/questions/3740253/custom-crop-size-in-uiimagepickercontroller. Here is the framework : https://github.com/yogev77/UIImagePickerWithEditor. But I haven't used it, so I can't give any opinion about it. – rdurand Aug 21 '12 at 11:33
  • There is your answer.. http://stackoverflow.com/questions/9041732/set-dimensions-for-uiimagepickercontroller-move-and-scale-cropbox – metinn Dec 21 '12 at 09:08

3 Answers3

15

I think you need change self.imgPicker.allowsEditing = YES; to self.imgPicker.allowsEditing = NO;

Alex
  • 6,957
  • 12
  • 42
  • 48
3

This library can help you.

https://github.com/gekitz/GKImagePicker

It supports custom cropping and it's easy to integrate with the native picker if needed.

Gui Moura
  • 1,360
  • 1
  • 16
  • 26
0

I think , this will serve your purpose . You can change the constraints as you want

https://github.com/kishikawakatsumi/PEPhotoCropEditor?source=cc

Vishal
  • 101
  • 1
  • 12