     }
     
     open var didCancel: (() -> Void)?
-    open var didFinishCapturingImage: ((_ image: UIImage) -> Void)?
+    open var didFinishCapturingImage: ((_ image: UIImage?, _ data: Data?) -> Void)?
     
     /// Notify the listener of the detected faces in the preview frame.
     open var onFaceDetection: ((_ faces: [AVMetadataFaceObject]) -> Void)?

                                let cropCGImage = takenCGImage.cropping(to: cropRect)
                                let cropTakenImage = UIImage(cgImage: cropCGImage!, scale: 1, orientation: takenImage.imageOrientation)
                                
                                didFinishCapturingImage(cropTakenImage)
                                
                                self.captureButton.isEnabled = true
                            }

import UIKit
import AVFoundation
import CoreMotion
import ImageIO

open class DKCameraPassthroughView: UIView {
    open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
