Skip to content

Instantly share code, notes, and snippets.

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
dismiss(animated: true, completion: nil)
guard let image = info["UIImagePickerControllerOriginalImage"] as? UIImage else {
return
}
UIGraphicsBeginImageContextWithOptions(CGSize(width: 224, height: 224), true, 1.0)
image.draw(in: CGRect(x: 0, y: 0, width: 224, height: 224))
let newImage = UIGraphicsGetImageFromCurrentImageContext()!