mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
Reduce + recode images to JPEG if they are too huge (#3956)
I.e. > 500K for the balanced media quality and 130K for the worse one. This can remove animation and transparency from PNG/WebP, but then a user always can send an image as a file. Also don't reduce wide/high images if they aren't huge. Among other benefits, this way most of PNG screenshots aren't touched. Also remove Exif from all images, not from JPEGs only.
This commit is contained in:
@@ -2026,7 +2026,7 @@ async fn prepare_msg_blob(context: &Context, msg: &mut Message) -> Result<()> {
|
||||
if msg.viewtype == Viewtype::Text || msg.viewtype == Viewtype::VideochatInvitation {
|
||||
// the caller should check if the message text is empty
|
||||
} else if msg.viewtype.has_file() {
|
||||
let blob = msg
|
||||
let mut blob = msg
|
||||
.param
|
||||
.get_blob(Param::File, context, !msg.is_increation())
|
||||
.await?
|
||||
|
||||
Reference in New Issue
Block a user