         }
     }
 }
+
+//Image Picker Delegate
+extension ScanViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
+    
+    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
+        picker.dismiss(animated: true, completion: nil)
+        var newImage: UIImage
+        if let possibleImage = info[.editedImage] as? UIImage {
+            newImage = possibleImage
+        } else if let possibleImage = info[.originalImage] as? UIImage {
+            newImage = possibleImage
+        } else {
+            return
+        }
+
+        if let features = detectQRCode(newImage), !features.isEmpty {
+            for case let row as CIQRCodeFeature in features {
+                if let message = row.messageString {
+                    DispatchQueue.main.async { [weak self] in
+                        self?.handleURI(message)
+                    }
+                }
+            }
+        }
+    }
+    
+    func detectQRCode(_ image: UIImage?) -> [CIFeature]? {
+        //sourced: https://stackoverflow.com/questions/35956538/how-to-read-qr-code-from-static-image
+        if let image = image, let ciImage = CIImage.init(image: image) {
+            var options: [String: Any]
+            let context = CIContext()
+            options = [CIDetectorAccuracy: CIDetectorAccuracyHigh]
+            let qrDetector = CIDetector(ofType: CIDetectorTypeQRCode, context: context, options: options)
+            if ciImage.properties.keys.contains((kCGImagePropertyOrientation as String)) {
+                options = [CIDetectorImageOrientation: ciImage.properties[(kCGImagePropertyOrientation as String)] ?? 1]
+            } else {
+                options = [CIDetectorImageOrientation: 1]
+            }
+            let features = qrDetector?.features(in: ciImage, options: options)
+            return features
+
+        }
+        return nil
+    }
+}

            }
        }
    }

    override var prefersStatusBarHidden: Bool {
        return true

    private let paymentRequestCurrencyRestriction: Currency?
    fileprivate let guide = CameraGuideView()
    fileprivate let session = AVCaptureSession()
    private let toolbar = UIStackView()
    private let close = UIButton.close
    private let flash = UIButton.icon(image: #imageLiteral(resourceName: "Flash"), accessibilityLabel: S.Scanner.flashButtonLabel)
    private let cameraRoll: UIButton = {
        let button: UIButton
        if #available(iOS 13.0, *) {
            button = UIButton.icon(image: UIImage(systemName: "photo.on.rectangle") ?? UIImage(), accessibilityLabel: "import")
        } else {
            button = UIButton(type: .system)
            button.setTitle("import", for: .normal)
        }
        return button
    }()
    
    fileprivate var currentUri = ""
    private var toolbarHeightConstraint: NSLayoutConstraint?
    private let toolbarHeight: CGFloat = 54.0
    private var hasCompleted = false
    
    init(forPaymentRequestForCurrency currencyRestriction: Currency? = nil, forScanningPrivateKeys: Bool = false, completion: @escaping ScanCompletion) {
