In my app i am capturing image from camera using UIImagePicker and than croping it. But problem is that when I capture image from camera in landscape mode, at the time of croping it in potrait mode the blackbox is shown in image.
Image is captured in landscape mode –

and at the time of using that image the black box is shown at upper and bottom part of image as shown in below image –

but I want to remove that black parts so that image covers whole area.
How can i do this ?
Are you cropping the image with
CGImageCreateWithImageInRect([image CGImage], rect);Or else can you share how exactly you are doing the cropping?
When image is taken from the
UIImagePickerControllerin landscape mode, you need to check the orientation property of the UIImage. ie[image orientation];if the orientation value is
UIInterfaceOrientationLandscapeLeft|UIInterfaceOrientationLandscapeRight, interchange between the rect width and height. And then crop it.