Skip to content

Make image-quality more consistent#7822

Open
72374 wants to merge 2 commits intochatmail:mainfrom
72374:make-image-quality-more-consistent
Open

Make image-quality more consistent#7822
72374 wants to merge 2 commits intochatmail:mainfrom
72374:make-image-quality-more-consistent

Conversation

@72374
Copy link
Contributor

@72374 72374 commented Feb 4, 2026

See commit-descriptions for more information.

@72374 72374 force-pushed the make-image-quality-more-consistent branch 3 times, most recently from 40721b8 to a32210d Compare February 4, 2026 15:47
@72374 72374 marked this pull request as ready for review February 4, 2026 16:08
@72374
Copy link
Contributor Author

72374 commented Feb 27, 2026

Here a comparison for the quality of images sent in chats.

Tap here to view the original images
Whole image Cropped to relevant content Further cropped to 1280 pixels Whole image cropped to square
Original image

1 - whole image - original (3840x2128 = 8,171,520 pixels)
3840x2128 =
8,171,520 pixels

2 - cropped to relevant content - original (3521×990 = 3,485,790 pixels)
3521×990 =
3,485,790 pixels

3 - further cropped to 1280 on the long side - original (1280x990 = 1,267,200 pixels)
1280x990 =
1,267,200 pixels

4 - cropped to square - original (2128x2128 = 4,528,384 pixels)
2128x2128 =
4,528,384 pixels

After sending Whole image Cropped to relevant content Further cropped to 1280 pixels* Whole image cropped to square*
Main branch

1 - whole image - main branch (907,520 pixels)
1280x709 =
907,520 pixels

2 - cropped to relevant content - main branch (460,800 pixels)
1280x360 =
460,800 pixels

3 - further cropped to 1280 pixels on the long side - main branch (1,267,200 pixels)
1280x990 =
1,267,200 pixels

4 - cropped to square - main branch (1,638,400 pixels)
1280x1280 =
1,638,400 pixels

This PR

1 - whole image - this pr (1,638,207 pixels)
1719x953 =
1,638,207 pixels

2 - cropped to relevant content - this pr (1,636,014 pixels)
2413x678 =
1,636,014 pixels

3 - further cropped to 1280 on the long side - this pr (1,267,200 pixels)
1280x990 =
1,267,200 pixels

4 - cropped to square - this pr (1,638,400 pixels)
1280x1280 =
1,638,400 pixels

*: The 2 columns on the right are supposed to be identical; i mostly included them, to make it visible that square-ish images already get encoded with up to ~1.6 megapixels, on the "main"-branch.

@72374 72374 force-pushed the make-image-quality-more-consistent branch 2 times, most recently from 75d524b to d23ef46 Compare March 2, 2026 14:09
@72374 72374 force-pushed the make-image-quality-more-consistent branch from d23ef46 to 2693448 Compare March 13, 2026 21:38
Copy link
Collaborator

@iequidoo iequidoo left a comment

Choose a reason for hiding this comment

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

Commit message "chore: Move the definition of the target_wh-variable" should be "refactor:".

Commit message "feat: Use the available file-size for avatar-images better" -- better tell what it actually does briefly, i.e. "feat: Change multiplier to 7/8 when scaling down huge avatars". Long explanation message can be left as is.

@72374 72374 force-pushed the make-image-quality-more-consistent branch 2 times, most recently from 79286ef to 380ea8e Compare March 16, 2026 13:42
@72374

This comment was marked as outdated.

@72374 72374 force-pushed the make-image-quality-more-consistent branch from 380ea8e to 6ce9415 Compare March 16, 2026 14:03
to the only part of the function where it is used.
@72374 72374 force-pushed the make-image-quality-more-consistent branch from 6ce9415 to 29614ae Compare March 16, 2026 17:05
@72374 72374 force-pushed the make-image-quality-more-consistent branch from 29614ae to 691535c Compare March 17, 2026 14:40
@iequidoo
Copy link
Collaborator

Maybe even this PR should be split into several ones so that it's reviewed and merged sooner, it's always hard to get the PR approved if there are multiple independent changes.

@iequidoo iequidoo requested a review from Hocuri March 17, 2026 17:24
@iequidoo iequidoo self-requested a review March 17, 2026 17:33
@iequidoo
Copy link
Collaborator

Thanks for noticing and fixing the problem! I think this will be great for panoramic photos and screenshots. Currently they have to be sent as "files", otherwise the quality isn't great.

@72374 72374 force-pushed the make-image-quality-more-consistent branch from 691535c to cf01d44 Compare March 18, 2026 12:30
@72374 72374 force-pushed the make-image-quality-more-consistent branch from cf01d44 to da929d7 Compare March 18, 2026 15:33
@72374
Copy link
Contributor Author

72374 commented Mar 18, 2026

Happy to help. :)

I moved the 2 commits related to the quality of avatar-images to #8010 .

@72374 72374 force-pushed the make-image-quality-more-consistent branch from da929d7 to 5e0df34 Compare March 19, 2026 11:35
@72374 72374 force-pushed the make-image-quality-more-consistent branch from 5e0df34 to 7c5bc44 Compare March 19, 2026 14:28
Currently, the resolution of a resized image that was sent in a chat,
depends on the aspect-ratio.

Assuming the `balanced`-quality-setting is used,
a square image, that is larger than the limits for resolution and file-size,
will be resized to 1280x1280 (1,638,400 pixels),
an image with an aspect-ratio of 16:9,
will be resized to 1280x720 (921,600 pixels),
and if the aspect-ratio is 32:9, to 1280x360 (460,800 pixels).

This change makes it so, that the number of pixels,
in images with different aspect-ratios, will be similar.
@72374 72374 force-pushed the make-image-quality-more-consistent branch from 7c5bc44 to d75c156 Compare March 22, 2026 11:52
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.

2 participants