Skip to content

feat: Don't scale down huge non-JPEGs, recode them first (#7977)#7992

Open
iequidoo wants to merge 1 commit intomainfrom
iequidoo/dont-resize-non-jpeg
Open

feat: Don't scale down huge non-JPEGs, recode them first (#7977)#7992
iequidoo wants to merge 1 commit intomainfrom
iequidoo/dont-resize-non-jpeg

Conversation

@iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Mar 15, 2026

If after recoding to JPEG an image isn't huge anymore, don't scale it down, this preserves quality of most screenshots. For JPEGs however we don't try to recode them w/o scaling down:

  • They are already JPEG-encoded, maybe with higher quality, but anyway.
  • We don't want extra CPU work for most photos.

Close #7977

@iequidoo iequidoo force-pushed the iequidoo/dont-resize-non-jpeg branch from cbe06c0 to 13efe75 Compare March 15, 2026 14:35
let (pre_message, _, _) = send_large_image_message(alice, a_group_id).await?;
let msg = bob.recv_msg(&pre_message).await;
assert_eq!(msg.text, "test".to_owned());
assert_eq!(msg.get_text(), "test [Image – 146.12 KiB]".to_owned());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's annoying to fix this number every time we change image encoding, even JPEG quality can't be changed

@iequidoo iequidoo force-pushed the iequidoo/dont-resize-non-jpeg branch 3 times, most recently from e5194f3 to 1208117 Compare March 15, 2026 14:57
If after recoding to JPEG an image isn't huge anymore, don't scale it down, this preserves quality
of most screenshots. For JPEGs however we don't try to recode them w/o scaling down:
- They are already JPEG-encoded, maybe with higher quality, but anyway.
- We don't want extra CPU work for most photos.
@iequidoo iequidoo force-pushed the iequidoo/dont-resize-non-jpeg branch from 1208117 to c780392 Compare March 15, 2026 15:19
@iequidoo iequidoo requested review from Hocuri and r10s March 15, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

screenshots are sometimes sent in poor quality

1 participant