I get a picture from the photo library and call it image using this code:
@IBAction func importImage(_ sender: AnyObject) {
let image = UIImagePickerController()
image.delegate = self
image.sourceType = UIImagePickerControllerSourceType.photoLibrary
image.allowsEditing = false
self.present(image, animated: true) { }
}
and this code:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
myImageView.image = image
dismiss(animated: true, completion: nil)
SubmitBtnOutlet.isHidden = false;
Gurpcontroller.person = "yours";
Gurpcontroller.collecterthing = "Coin";
PictureViewController.imageuniversal = myImageView
} else {
//Error message
}
}
I want to see if image is landscape or portrait. Then, if it is landscape I want to change it to portrait.
portrait, to clarify the question as an image orientation question to always get the image toportraitmode.landscapemode. From there, you can rotate or crop to your heart's content to recover aportraitimage.