06/22 Fix Medium impact items

This commit is contained in:
Nguyen Ngo
2026-06-22 11:40:05 -04:00
parent e68a702bf9
commit 93ee02ea18
6 changed files with 297 additions and 7 deletions
@@ -38,7 +38,8 @@ private let kImgJPEGQuality: CGFloat = 0.55
/// kImgJPEGQuality, returning a fresh UIImage built from the compressed
/// bytes. Applied to every photo before it's embedded in the PDF this is
/// the main lever for keeping file size minimal.
private func compress(_ image: UIImage) -> UIImage? {
/// nonisolated: called from inside a TaskGroup (concurrent), not @MainActor.
private nonisolated func compress(_ image: UIImage) -> UIImage? {
let size = image.size
guard size.width > 0, size.height > 0 else { return nil }
let scale = min(kImgMaxPx / size.width, kImgMaxPx / size.height, 1.0)