拍照后剪裁

时间:2013-07-25 13:34:02

标签: ios photo

我正在使用Allowsedditing裁剪我在应用中拍摄的照片但由于它反弹而无效。有没有去做这个任务?我被告知我应该使用GKIIMagePicker,但它不起作用。我该怎么做?

- (IBAction)takePhoto:(UIButton *)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    self.imagePicker = [[GKImagePicker alloc] init];
    self.imagePicker.cropSize = CGSizeMake(320, 90);
    self.imagePicker.delegate = self;
    self.imagePicker.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:self.imagePicker.imagePickerController animated:YES];

}

1 个答案:

答案 0 :(得分:0)

这有效:

UIImage *image = [UIImage imageNamed:@"myImage"];
NSData *data = UIImageJPEGRepresentation(image, 1.0);

//reduce size of image (scale down)
UIImage *image2 = [UIImage imageWithData:data scale:2.0];
//increase size of image (scale up)
UIImage *image3 = [UIImage imageWithData:data scale:0.5];

指定您自己的CGFloat值作为裁剪比例。