Swift – Getting iOS 8 UIImage Orientation Property

ios8phassetswiftuiimage

I am loading photos from the users Photo roll.

    PHImageManager.defaultManager().requestImageForAsset(asset, targetSize:size, contentMode: .AspectFill, options: options)
            {
                result, info in
                //get orientation???
                var image:iImage = iImage(uiimage: result)
                self.selectedPhotoUpdateCallback(editImage,image)
            }

However, some times the photos I load are upside down.

I cannot seem to find any information on the meta data for the orientation of these images.

Do you know how I can check the orientation of the requested asset from a PHImageManager?

The picture displays upright when I am selecting from the photo roll, but when I load the full image into another view its rotated (and my code does not apply any rotation).

Best Answer

You can get the image orientation via image.imageOrientation. Also you can check out this link.

Related Topic