0
votes

On iOS 5 using an iPhone 4s I am trying to pick a photo from the camera roll using UIImagePickerController. The problem I am having is that the image that I pick always has the following attributes (regardless of wether the image is portrait or landscape):

image.size.width = 3264
image.size.height = 2448
image.orientation = UIImageOrientationUp

The UIImage returned from didFinishPickingMediaWithInfo does not seem to give me access to the orientation of the photo.

Is there something a UIImageView uses other than UIImage.UIImageOrientation to specify either a landscape or portrait photo?

Im not using a UIImageView to display the photo so I need to figure out what UIImageView is doing to correct the orientation.

Thanks

3

3 Answers

1
votes

Read this: UIImagePickerController Image Orientation

I use the category UIImage+Resize to get the correct orientation after picking the image

0
votes

In my case I was using the CGImage which does not keep the orientation info.

-2
votes

if image.size.width / image.size.height > 1 then it is landsacpe image

if image.size.width / image.size.height < 1 then it is portrait image