How to get rid of black earth in an image returned from UIImagePickerControllerEditedImage when using UIImagePicker

When using UIImagePicker, it allows you to switch to edit mode. Then for an image taken in landscape mode, if the user does not manually scale it in UIImagePicker, there will be a black bar / background on the top and bottom of the image. Is there any way to get rid of this and make this part of the image transparent?

+2
ios iphone uiimage uiimagepickercontroller
source share
1 answer
#pragma mark UIImagePickerControllerDelegate - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *img = nil; CGRect cropRect = [[info valueForKey:UIImagePickerControllerCropRect] CGRectValue]; if (cropRect.origin.y < 0) { img = [info objectForKey:UIImagePickerControllerOriginalImage]; } else { img = [info objectForKey:UIImagePickerControllerEditedImage]; } } 
+3
source share

All Articles