Picked photo in the gallery does not recognise image orientation

When picking a photo in the gallery, whatever the orientation of the original image, size is always as landscape

if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.editedImage)] as? UIImage { 
                    print("picked original", image.size)

For a portrait photo:

picked original (1122.0, 932.0)

For a landscape:

picked original (1124.0, 844.0)

What am I missing ?

Answered by Claude31 in 824931022

Found it. Must use originalImage and not editedImage

if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.originalImage)] as? UIImage { 
Accepted Answer

Found it. Must use originalImage and not editedImage

if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.originalImage)] as? UIImage { 
Picked photo in the gallery does not recognise image orientation
 
 
Q