Skip to content

Commit

Permalink
fix(ios): iOS panorama photos selected through CameraPlugin are corru…
Browse files Browse the repository at this point in the history
…pted (#2090)
  • Loading branch information
OS-ricardomoreirasilva committed Apr 24, 2024
1 parent f784a3e commit 998e495
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions camera/ios/Sources/CameraPlugin/CameraExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ internal extension UIImage {
targetHeight = maxHeight
}
// generate the new image and return
let format: UIGraphicsImageRendererFormat = UIGraphicsImageRendererFormat.default()
format.scale = 1.0
format.opaque = false
let renderer = UIGraphicsImageRenderer(size: CGSize(width: targetWidth, height: targetHeight), format: format)
return renderer.image { (_) in
self.draw(in: CGRect(origin: .zero, size: CGSize(width: targetWidth, height: targetHeight)))
}
UIGraphicsBeginImageContextWithOptions(.init(width: targetWidth, height: targetHeight), false, 1.0) // size, opaque and scale
self.draw(in: .init(origin: .zero, size: .init(width: targetWidth, height: targetHeight)))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage ?? self
}
}

0 comments on commit 998e495

Please sign in to comment.