 
     fileprivate func takePhoto() {
         queue.async { [unowned self] in
-            let photoSettings = AVCapturePhotoSettings()
+            let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg])
             photoSettings.flashMode = .auto
             photoSettings.isHighResolutionPhotoEnabled = true
             self.output.capturePhoto(with: photoSettings, delegate: self)

        let photo = UIImage(cgImage: cropped, scale: 1, orientation: .up)
        return photo
    }

    @available(iOS 11.0, *)
    public func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Swift.Error?) {

    }
}

    }

    func cropp(_ image: CGImage, preview: CGSize, outline: CGSize) -> UIImage? {
        //TODO: fix cropping for iPhone X
        //original image size
        let height: CGFloat = CGFloat(image.height)
        let width: CGFloat = CGFloat(image.width)
