         rect.origin = .zero
         
         let renderer = UIGraphicsImageRenderer(size: rect.size)
+
         return renderer.image { renderContext in
             renderContext.cgContext.translateBy(x: rect.midX, y: rect.midY)
             renderContext.cgContext.rotate(by: CGFloat(degrees * .pi / 180.0))


        DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
            print("Start OCR")
            
            self.pictureOutput = PictureOutput()
            self.pictureOutput.encodedImageFormat = .png
            self.pictureOutput.onlyCaptureNextFrame = true
            self.pictureOutput.imageAvailableCallback = { sourceImage in
                if self.processImage(sourceImage: sourceImage) { return }
                
                // Not successfull, start another scan
                self.StartScan(sender: self)
            }
            self.crop --> self.pictureOutput


    :param: mrz The MRZ result
    */
    open func successfulScan(mrz: MRZ) {
        assertionFailure("You should overwrite this function to handle the scan results")
    }

    /**
    Override this function in your own class for processing a cancel
    */
    open func abortScan() {
        assertionFailure("You should overwrite this function to handle an abort")
    }
}


// Wanted to use this rotation function. Tesseract does not like the result image.
// Went back to GpuImage for the rotation.
// Will try again later so that we can remove the old GpuImage dependency
@available(iOS 10.0, *)
extension UIImage {
    func rotate(by degrees: Double) -> UIImage? {
