0

In my iPhone application I take an image with UIImagePickerController from PhotoLibrary. How can I get correct imageOrientation property?

Update In any case I get UIImageOrientationUp

Shekhar Gupta
  • 6,206
  • 3
  • 30
  • 50
revolutionkpi
  • 2,632
  • 10
  • 45
  • 84
  • http://stackoverflow.com/questions/16009522/uiimagepickercontroller-check-if-returned-image-is-in-landscape-or-portrait – Rushabh Aug 19 '13 at 10:18
  • in any case I get UIImageOrientationUp! – revolutionkpi Aug 19 '13 at 11:00
  • You can check this post http://stackoverflow.com/questions/38083293/after-getting-image-from-uiimagepickercontroller-uiimageview-rotates-image-for/38135833#38135833 – Naren Jul 01 '16 at 01:59

4 Answers4

0
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

        UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
        UIImageOrientation imageOrientation = image.imageOrientation;

    }
B.S.
  • 21,660
  • 14
  • 87
  • 109
0

USE this method like for image named "image1"

[self checkImageOrientaionImage:image1];

Method:

-(void)checkImageOrientaionImage:(UIImage*)image
{

    if (image.imageOrientation == UIImageOrientationUp)
    {
        NSLog(@"portrait");
    }
   else if (image.imageOrientation == UIImageOrientationLeft || image.imageOrientation == UIImageOrientationRight)
    {
       NSLog(@"landscape");
    }

}

Puru
  • 32
  • 7
0

Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.

As per the UIImagePickerController Class Reference

Check this question also: Stack over flow link

Community
  • 1
  • 1
Puru
  • 32
  • 7
-1

Write this code in your didFinishPickingMediaWithInfo delegate method

Get the UIImage from the info dictionary .

And then use this UIImageOrientation orient = image.imageOrientation;

Tendulkar
  • 5,550
  • 2
  • 27
  • 53