diff --git a/Tusker/Models/CompositionAttachmentData.swift b/Tusker/Models/CompositionAttachmentData.swift index b8f424a60f..3f5fa6dc88 100644 --- a/Tusker/Models/CompositionAttachmentData.swift +++ b/Tusker/Models/CompositionAttachmentData.swift @@ -51,7 +51,10 @@ enum CompositionAttachmentData { func getData(completion: @escaping (_ data: Data, _ mimeType: String) -> Void) { switch self { case let .image(image): - completion(image.pngData()!, "image/png") + // Export as JPEG instead of PNG, otherweise photos straight from the camera are too large + // for Mastodon in its default configuration (max of 10MB). + // The quality of 0.8 was chosen completely arbitrarily, it may need to be tuned in the future. + completion(image.jpegData(compressionQuality: 0.8)!, "image/jpeg") case let .asset(asset): if asset.mediaType == .image { let options = PHImageRequestOptions()