       renderedImage = cgImage.cropping(to: cropRect.applying(cropRectTransform))
 
       // Modify the metadata to change the dimensions now that they're different.
-      exifData?.setValue(NSNumber(value: Float(cropRect.size.width)),
-                         forKey: kCGImagePropertyExifPixelXDimension as String)
-      exifData?.setValue(NSNumber(value: Float(cropRect.size.height)),
-                         forKey: kCGImagePropertyExifPixelYDimension as String)
-      mutableMetadata.setValue(exifData, forKey: kCGImagePropertyExifDictionary as String)
+      exifData?[kCGImagePropertyExifPixelXDimension as String] = cropRect.size.width
+      exifData?[kCGImagePropertyExifPixelYDimension as String] = cropRect.size.height
+      mutableMetadata[kCGImagePropertyExifDictionary as String] = exifData
     } else {
       // Update dimensions based on image rotation.
-      exifData?.setValue(NSNumber(value: Float(finalMetadataSize.width)),
-                         forKey: kCGImagePropertyExifPixelXDimension as String)
-      exifData?.setValue(NSNumber(value: Float(finalMetadataSize.height)),
-                         forKey: kCGImagePropertyExifPixelYDimension as String)
+      exifData?[kCGImagePropertyExifPixelXDimension as String] = finalMetadataSize.width
+      exifData?[kCGImagePropertyExifPixelYDimension as String] = finalMetadataSize.height
     }
     // Set the final orientation into metadata.
-    mutableMetadata.setValue(metadataOrientation, forKey: kCGImagePropertyOrientation as String)
+    mutableMetadata[kCGImagePropertyOrientation as String] = metadataOrientation
     // Update the EXIF data.
-    mutableMetadata.setValue(exifData, forKey: kCGImagePropertyExifDictionary as String)
+    mutableMetadata[kCGImagePropertyExifDictionary as String] = exifData
 
     // Attempt to generate an orientation-correct image that is cropped if necessary, at the
     // correct scale.

  /// Captures the current image as data and calls the delegate when complete.
  func captureImageData(isCropping: Bool) {
    shouldCropCapturedPhoto = isCropping
    let settings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecJPEG])
    photoOutput.capturePhoto(with: settings, delegate: self)
  }


      return
    }

    guard let photoData = photo.fileDataRepresentation() else {
      sjlog_error("Could not create jpeg photo data representation", category: .general)
      delegate?.photoCapturerDidCapturePhotoData(nil, metadata: nil)
      return
    }

    // Metadata
    var mutableMetadata = photo.metadata
    var exifData = mutableMetadata[kCGImagePropertyExifDictionary as String] as? [String: Any]

    guard let originalImage = UIImage(data: photoData), let cgImage = originalImage.cgImage else {
      sjlog_error("Could not create original image", category: .general)
